python
runtime_error
ai_generated
true
PytestWarning: Slow test detected: test_heavy_computation took 5.23s
ID: python/pytest-slow-test-warning
80%Fix Rate
85%Confidence
0Evidence
2025-12-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
The pytest-slow-test plugin or a custom hook flags a test that exceeds a time threshold. This is a warning, not an error, but may be treated as an error if warnings are errors.
generic中文
pytest-slow-test 插件或自定义钩子标记了超过时间阈值的测试。这是警告而非错误,但如果警告被视为错误,则会导致失败。
Workarounds
-
95% success
Use smaller datasets, mock heavy operations, or use caching.
-
90% success
@pytest.mark.slow def test_heavy_computation(): ... Run with: pytest -m 'not slow' -
85% success
@pytest.mark.slow_test_threshold(10) def test_heavy_computation(): ...
Dead Ends
Common approaches that don't work:
-
90% fail
This reduces coverage and may remove important test cases.
-
80% fail
This masks the performance issue and may allow very slow tests to persist.
-
70% fail
If warnings are errors, the test suite still fails.