From: Serhiy Storchaka Date: Fri, 6 Mar 2015 21:32:54 +0000 (+0200) Subject: Issue #22853: Added regression test for using multiprocessing.Queue at import X-Git-Tag: v3.5.0a2~13^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f8904e99c754f4cbded0ac3cf32a9ca4a6043af9;p=thirdparty%2FPython%2Fcpython.git Issue #22853: Added regression test for using multiprocessing.Queue at import time. Patch by Davin Potts. --- diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 9466d4ebd6ac..342688c63495 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -713,6 +713,27 @@ class _TestQueue(BaseTestCase): for p in workers: p.join() + def test_no_import_lock_contention(self): + with test.support.temp_cwd(): + module_name = 'imported_by_an_imported_module' + with open(module_name + '.py', 'w') as f: + f.write("""if 1: + import multiprocessing + + q = multiprocessing.Queue() + q.put('knock knock') + q.get(timeout=3) + q.close() + del q + """) + + with test.support.DirsOnSysPath(os.getcwd()): + try: + __import__(module_name) + except pyqueue.Empty: + self.fail("Probable regression on import lock contention;" + " see Issue #22853") + def test_timeout(self): q = multiprocessing.Queue() start = time.time()