--parallel=fork swallows exceptions during child process setup
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
Medium
|
Martin Packman |
Bug Description
If any kind of exception happens prior to the test run in a child process when using --parallel=fork, rather than the exception being reported, subunit simply reports that 0 tests have been run.
This is down to the following code testtools.
if pid == 0:
try:
...
finally:
Because os._exit(0) is called in all cases, the normal python error processing, which involves printing the traceback to stderr and setting a suitable return code, does not happen. And subunit takes this to mean a successful run of zero tests.
Do the old rules about calling _exit from child processes even apply in Python? It seems most of them are just assuming you screwed up the lifetime of all your file handles by inheriting the lot, which... is something bzr needs to fix anyway.
Related branches
- Jelmer Vernooij (community): Approve
-
Diff: 198 lines (+79/-43)3 files modifiedbzrlib/tests/__init__.py (+13/-9)
bzrlib/tests/test_selftest.py (+63/-34)
doc/en/release-notes/bzr-2.5.txt (+3/-0)
Changed in bzr: | |
assignee: | nobody → Martin Packman (gz) |
status: | Confirmed → In Progress |
Changed in bzr: | |
milestone: | none → 2.5b3 |
status: | In Progress → Fix Released |
I think I may have seen something like this cause a confusing error when there was a syntax error in code or similar only hit starting the child process.
I think fixing the handles to be close-on-exec where appropriate could be good. Also just having an 'except' block that prints an error and returns 1 would be cheap and worthwhile.