How and where does py.test find fixtures

前端 未结 3 1566
别跟我提以往
别跟我提以往 2020-12-14 15:07

Where and how does py.test look for fixtures? I have the same code in 2 files in the same folder. When I delete conftest.py, cmdopt cannot be found running tes

3条回答
  •  无人及你
    2020-12-14 15:54

    py.test will import conftest.py and all Python files that match the python_files pattern, by default test_*.py. If you have a test fixture, you need to include or import it from conftest.py or from the test files that depend on it:

    from sonoftest import pytest_addoption, cmdopt
    

提交回复
热议问题