diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-06 23:32:54 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-06 23:32:54 +0200 |
commit | f8904e99c754f4cbded0ac3cf32a9ca4a6043af9 (patch) | |
tree | db193667f8226a8ce7eded9e6b6df6131eb95f52 | |
parent | c19ed37579877667c791458ac2bbacd5190c3ccc (diff) | |
download | cpython-git-f8904e99c754f4cbded0ac3cf32a9ca4a6043af9.tar.gz |
Issue #22853: Added regression test for using multiprocessing.Queue at import
time. Patch by Davin Potts.
-rw-r--r-- | Lib/test/_test_multiprocessing.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 9466d4ebd6..342688c634 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() |