How to tell py.test to skip certain directories?

后端 未结 8 1387
情话喂你
情话喂你 2021-02-06 20:07

I tried to use the norecursedirs option inside setup.cfg to tell py.test not to collect tests from certain directories but it seems it does ignore it.

[tool:pyte         


        
8条回答
  •  隐瞒了意图╮
    2021-02-06 20:31

    To use pytest.ini (which is recommended, unless you're using tox in which case tox.ini would make sense), call pytest with pytest -c pytest.ini.

    In order to prevent my sample not_me_1.py and not_me_2.py from being tested or linted, my pytest.ini is as follows:

    [pytest]
    addopts = --ignore-glob=not_me_*
    
    [pycodestyle]
    ignore = not_me_* ALL
    
    

提交回复
热议问题