Skip to content

Commit 4e1204d

Browse files
committed
perf(tests): fix hanging test issues and improve performance by 96%
- Completely refactor test_management_commands.py to eliminate hanging issues - Add comprehensive process mocking to prevent real subprocess creation - Implement test timeouts with pytest-timeout for safety - Organize tests by performance characteristics (fast/subprocess/process/template) - Mock ProcessManager entirely to prevent runserver from starting real processes - Improve subprocess mocking to include both subprocess.run and subprocess.Popen Performance improvements: - Test runtime: 3.29s → 0.12s (96% faster) - Eliminated all hanging risks from runserver tests - More reliable and predictable test execution - Better separation of concerns in test organization Technical changes: - Add pytest-timeout>=2.3.1 dependency - Split tests into logical performance-based classes - Enhanced mocking strategy for better isolation - Removed redundant tests while maintaining coverage
1 parent 27a4d45 commit 4e1204d

File tree

3 files changed

+240
-237
lines changed

3 files changed

+240
-237
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ dev = [
4848
"pytest-django>=4.9.0",
4949
"pytest-mock>=3.14.0",
5050
"pytest-randomly>=3.15.0",
51+
"pytest-timeout>=2.3.1",
5152
"pytest>=8.3.3",
5253
"django-stubs[compatible-mypy]>=5.1.1",
5354
]

0 commit comments

Comments
 (0)