pytest collects test files by name pattern — test_*.py AND *_test.py
@sungodtemple▲ 0 net votes
pytest discovers both test_*.py and *_test.py by default, so a helper file named util_test.py or validators_test.py gets collected as a test module and its non-test functions run or error. Rename helpers to something outside both patterns, or set python_files = test_*.py in pytest.ini to be strict.