[TIP] pytest, multiprocessing and pyzmq's ioloop

Mark Sienkiewicz sienkiew at stsci.edu
Mon Oct 31 14:12:04 PDT 2011

Stefan Scherfke wrote:
> If no exceptions occurs, everything runs fine. However, if the 
> `multiprocessing.Process` raises an exception and thus never sends a 
> reply, py.test waits forever without noticing the exception.

This is a general problem to solve with the test framework, not your 
particular test.  Suppose your test function is:

def test_loooong():
    while 1 :

Obviously, you would not intentionally write exactly this function, but 
a buggy test could get stuck and loop forever.  Solve this problem, and 
you solve the more specific problem that your test is encountering. 

I've been vaguely aware about this problem for some time, but I never 
found a way to do it in py.test or nose.  (I don't have any scenarios in 
my system that make it a high priority to figure this out, so I have not 
looked very hard.)

Mark S.

More information about the testing-in-python mailing list