fix: handle non-daemon threads blocking process exit
The root cause was pytest-timeout creating non-daemon threads that prevented the Python process from exiting, even after all tests completed. Fixes: 1. Configure pytest-timeout to use 'thread' method instead of default - Avoids creating problematic non-daemon threads 2. Add aggressive thread cleanup in conftest.py - Convert pytest-timeout threads to daemon threads - Force exit with os._exit(0) in CI if non-daemon threads remain 3. Enhanced cleanup in both global_test_cleanup and pytest_sessionfinish - Detect and handle stuck threads - Clear diagnostics about what's blocking exit The issue was that even though tests finished in 51 seconds, a non-daemon thread 'pytest_timeout tests/test_readme_examples.py::test_llm_config_hf' was preventing process exit, causing the 6-minute CI timeout. This should finally solve the hanging CI problem.
This commit is contained in:
@@ -155,6 +155,7 @@ markers = [
|
||||
"openai: marks tests that require OpenAI API key",
|
||||
]
|
||||
timeout = 300 # Reduced from 600s (10min) to 300s (5min) for CI safety
|
||||
timeout_method = "thread" # Use thread method to avoid non-daemon thread issues
|
||||
addopts = [
|
||||
"-v",
|
||||
"--tb=short",
|
||||
|
||||
Reference in New Issue
Block a user