python
config_error
ai_generated
true
fixture 'test_data' not found
ID: python/pytest-fixture-not-found
80%Fix Rate
88%Confidence
0Evidence
2024-06-18First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
The fixture is defined in a conftest.py file that is not in the same directory or a parent directory of the test file, or the fixture name is misspelled.
generic中文
fixture 定义在 conftest.py 中,但该文件不在测试文件所在目录或其父目录中,或者 fixture 名称拼写错误。
Workarounds
-
98% success
Create conftest.py in the test directory and define the fixture there.
-
90% success
Verify the fixture name and that it's defined at module level.
Dead Ends
Common approaches that don't work:
-
50% fail
If the fixture is needed by multiple tests in different files, it won't be available.
-
80% fail
Fixture names are case-sensitive and must match exactly.