代码之家  ›  专栏  ›  技术社区  ›  Ringo De Smet

禁用pytest插件在本地工作,在CI上不工作

  •  0
  • Ringo De Smet  · 技术社区  · 7 年前

    我有一个pytest设置,其中包含以下用于集成测试的配置文件:

    [pytest]
    addopts = -p no:python -p no:random-order --tb=short
    junit_suite_name = Integration
    filterwarnings =
        ignore::DeprecationWarning
    

    目的是不加载 random-order 插件。在本地运行时,我将其作为输出:

    $ pytest -c pytest-integration.ini --junitxml=integration-tests.xml tests/integration/
    
    ======================= test session starts ===========================
    platform darwin -- Python 3.6.4, pytest-3.7.2, py-1.7.0, pluggy-0.8.0
    rootdir: /Users/ringods/Projects/customer/project/tests/integration, 
    inifile: pytest-integration.ini
    plugins: cov-2.6.0, mamba-1.0.0
    collected 629 items
    

    如所料,没有 随机顺序 插件。我将更改推送到构建服务器(Jenkins),这是Jenkins的输出:

    + pytest -c pytest-integration.ini --junitxml=integration-tests.xml tests/integration/
    
    ===================== test session starts ========================
    platform linux -- Python 3.6.3, pytest-3.7.2, py-1.7.0, pluggy-0.8.0
    Test order randomisation NOT enabled. Enable with --random-order or -- random-order-bucket=<bucket_type>
    rootdir: /home/centos/workspace/test-reporting-L2CS5UFPVK3I5UNI6BJIMJPWQQMDOV465LKDS2BSKJ5UXDZGAI6Q/tests/integration, inifile: pytest-integration.ini
    plugins: random-order-1.0.4, cov-2.6.0, mamba-1.0.0
    collected 629 items
    

    我好像找不到为什么 插件仍在加载中。有人能帮我吗?

    1 回复  |  直到 7 年前
        1
  •  0
  •   Amit Nanaware    7 年前

    确保本地使用的配置文件与Jenkins中的相同。