[issue11240] Running unit tests in a command line tool leads to infinite loop with multiprocessing on Windows

Martin Dengler report at bugs.python.org
Tue Mar 4 23:37:47 CET 2014


Martin Dengler added the comment:

> the root issue turned out to be that when you execute any multiprocessing statements at the module/script level on Windows, you need to put it under if __name__ == "__main__", otherwise it will cause infinite spawning.

Same for me.  The error message and failure mode are completely unhelpful, though.

> I think this is mentioned in the multiprocessing docs but should probably be in giant blinking red letters ;)

Indeed.  It would be even better if I or someone else had time to contribute a patch to fix the behaviour and, or at least the failure mode / error message.  In a large codebase with multiple contributors it might not be so simple to track down the commit that caused the issue, especially if one is just starting out and the tests aren't clean.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11240>
_______________________________________


More information about the Python-bugs-list mailing list