summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-03-06 21:33:51 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-03-06 21:33:51 (GMT)
commiteef20de744cfdf971d5a80d6e3f9c7f7cb9e14fc (patch)
tree4808901ac9ea08fbd3e21427c34ee54b1dd5db8d /Lib
parentf01c782960f1e4bafa35f908ab3b203db4537253 (diff)
parentf8904e99c754f4cbded0ac3cf32a9ca4a6043af9 (diff)
downloadcpython-eef20de744cfdf971d5a80d6e3f9c7f7cb9e14fc.zip
cpython-eef20de744cfdf971d5a80d6e3f9c7f7cb9e14fc.tar.gz
cpython-eef20de744cfdf971d5a80d6e3f9c7f7cb9e14fc.tar.bz2
Issue #22853: Added regression test for using multiprocessing.Queue at import
time. Patch by Davin Potts.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/_test_multiprocessing.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index d048f6f..4520c6a 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()