python
config_error
ai_generated
true
no tests ran in 0.01s ERROR: file or directory not found: tests/test_missing.py
ID: python/pytest-deselect-no-tests
80%Fix Rate
86%Confidence
0Evidence
2025-03-18First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 7.x | active | — | — | — |
| 8.x | active | — | — | — |
Root Cause
A path passed to pytest does not exist, or a -k expression matched nothing (the latter usually shows 'no tests ran' without the file error). Often caused by a typo in CI config or a renamed test file.
generic中文
传给 pytest 的路径不存在,或 -k 表达式未匹配任何测试(后者通常只显示 'no tests ran' 而无文件错误)。常见于 CI 配置拼写错误或测试文件被重命名。
Workarounds
-
95% success
pytest --collect-only tests/ -q # check the file exists: ls tests/test_missing.py # fix the path in CI config
-
90% success
pytest --collect-only -q -k 'login and not slow' pytest -k 'login and not slow'
Dead Ends
Common approaches that don't work:
-
85% fail
Hides the fact that the intended test file was renamed or moved; real tests are silently skipped.
-
50% fail
Runs everything, which may be slow and may include tests that were intentionally excluded.