Configure Pytest discovery to ignore class name

后端 未结 5 930
生来不讨喜
生来不讨喜 2021-01-11 14:16

Pytest\'s default discovery rules will import all Class starting with Test that do not have an __init__(). I have a situation where this causes an

5条回答
  •  温柔的废话
    2021-01-11 14:41

    Put all tests into files starting with test_ and add this to your pytest.ini:

    [pytest]
    python_files=test_*.py
    

    This will instruct pytest to discover tests only in test_*.py files.

提交回复
热议问题