[Python-checkins] cpython (3.4): Issue #22853: Added regression test for using multiprocessing.Queue at import

serhiy.storchaka python-checkins at python.org
Fri Mar 6 22:35:36 CET 2015


https://hg.python.org/cpython/rev/cf12856bde17
changeset:   94886:cf12856bde17
branch:      3.4
parent:      94883:72b08d351a9b
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Fri Mar 06 23:32:54 2015 +0200
summary:
  Issue #22853: Added regression test for using multiprocessing.Queue at import
time.  Patch by Davin Potts.

files:
  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
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -713,6 +713,27 @@
         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()

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list