| Age | Commit message (Collapse) | Author |
|
increase sleep margin (SEMANTIC-RUNNER-INTERRUPT)
- On Windows, terminate child processes using taskkill /F /T /PID to ensure
launcher processes (e.g. venv python.exe wrappers) terminate all child workers.
- Increase synthetic sleep duration in tests from 5s to 10s and timeout margin to
eliminate timing flakiness under high machine load.
AI-assisted (Claude Code).
|
|
interrupt (SEMANTIC-RUNNER-INTERRUPT)
Catch KeyboardInterrupt in run_semantic_tests.py, cancelling queued test modules via pool.shutdown(wait=False, cancel_futures=True) and terminating active child subprocesses so that no orphaned zombie processes or queued modules run after Ctrl+C. In serial mode (-j 1), terminate the discover subprocess on interrupt.
Return exit code 130 and output 'interrupted' to stderr without printing a false success summary.
Adds regression and lifecycle tests in tests/test_run_semantic_tests.py.
AI-assisted (Claude Code)
|
|
The count came from a line of the shape "Ran N tests in ..." in the module's
stderr. unittest writes that summary after every test has run, but a module
can write a line of the same shape after it: an atexit handler that runs a
nested runner does exactly that, and the runner counted "Ran 0 tests", so a
module with one passing test looked empty and the run exited 1 with "no
tests ran".
The count is now taken from unittest's own result object. The child program
runs the module through unittest's program, the way "python -m unittest
<module>" does, writes the result to a file and exits with unittest's own
exit codes: 1 when a test failed, 5 when nothing ran at all, 0 otherwise.
Nothing the module writes can change the count any more.
Follow-up to @lixonik's review on #662, which asked for the count to come
from the result rather than from a line of the module's stderr. AI-assisted.
|
|
A test that runs a nested unittest runner writes that runner's summary to
stderr while the test runs, before unittest writes its own. The count came
from the first "Ran N tests" line in stderr, so a nested summary of "Ran 0
tests" was counted and a passing module looked empty: the runner exited 1
with "no tests ran".
The count is now the last summary in stderr, which is unittest's own: it
writes that summary after every test has run, so nothing a test wrote can
come after it. A summary a test writes to stdout is never counted at all.
|
|
unittest writes its own summary (Ran N tests in X s) and its NO TESTS RAN to stderr, while a test's own
output goes to stdout. The runner scanned the merged output for the first line of that shape, so a test that
printed one could be counted instead of the summary, and which line won depended on stdout buffering.
Reported by @Dezmonius on #14. AI-assisted.
|
|
fails
`python -m unittest pkg.__init__` imports pkg and then executes the same file again as
pkg.__init__, so a registration in the initializer happens twice in the -j 2 worker while
discover imports it once. Hand unittest the package name instead; module_path() still
resolves the initializer, so the largest-file-first order is unchanged.
A suite whose only module is an empty package initializer reported "1 files, 0 tests, 0
files failed" and exit 0 in parallel mode, where -j 1 (discover) exits 5. A run where every
job ran no tests now prints "no tests ran" and exits 1; an empty initializer next to real
tests is still fine because those count.
Both new cases in tests/test_run_semantic_tests.py fail against the previous script.
|
|
unittest discover loads TestCase classes defined in a package's __init__.py regardless of the filename pattern. The parallel runner only selected test*.py files, so a failing package initializer could be skipped while -j 1 reported it. Include package initializers in the parallel module list; an empty initializer with no tests is not a failure. Add regressions for failing initializers and for a pattern that matches no test filenames.
AI-assisted.
|
|
|
|
|
|
|
|
parallel (253 s -> 26 s) (#4961)
Squash-merged after review of PR #4961 - scripts/run_semantic_tests.py: run tests/semantic one process per file, in parallel (253 s -> 26 s)
|