nose-devs/nose — pull request #659 by jszakmeister (2013-03-18 10:36:00+00:00)
Title: Make test_multiprocessing.test_keyboardinterrupt much more reliable.

It turns out that even under Linux, start up times for subprocesses can
vary considerably. As with most threading/multiprocess-based solutions,
sleep() proves to be an inadequate solution to knowing when to send a
signal to interrupt a waiting process. We may end up sending the kill
signal before the child process is on the right statement, causing some
assertions to fail in our tests.

Instead, let's introduce the concept of a kill file in these tests. The
kill file will be generated by the unit-under-test, and we'll wait for
them to show up. This works much better since the kill file is created
just before the sleep() in the unit-under-test. Once we detect the kill
file, then we can remove it, and fire off the signal. Where I was
seeing random failures before, I no longer see them now.