I have a Tkinter GUI running two threads, the main tread for the GUI and a worker thread. The worker thread creates a subprocess using the following code:
myProcess = subprocess.Popen(['python', '-u', 'runTests.py'],
The Python documentation [ http://docs.python.org/library/signal.html ] says:
- Although Python signal handlers are called asynchronously as far as the Python user is concerned, they can only occur between the “atomic” instructions of the Python interpreter. This means that signals arriving during long calculations implemented purely in C (such as regular expression matches on large bodies of text) may be delayed for an arbitrary amount of time.
So if your five-minute unit test is doing "a long calculation implemented purely in C", and your unit test harness installs a handler for
SIGTERM, that's your problem. If so, try
myProcess.kill instead of
myProcess.terminate (or, if you haven't got 2.6,
SIGKILL is uncatchable from user space and should have immediate effect.
Warning: any clean-up actions that are supposed to run on the way out of your unit test framework will not be executed.