diff -r b3d4fd17e96d Lib/test/_test_multiprocessing.py --- a/Lib/test/_test_multiprocessing.py Fri Mar 06 09:10:45 2015 -0500 +++ b/Lib/test/_test_multiprocessing.py Fri Mar 06 15:21:03 2015 -0600 @@ -713,6 +713,34 @@ for p in workers: p.join() + def test_no_import_lock_contention(self): + import textwrap + + module_name = 'imported_by_an_imported_module' + filename = module_name + ".py" + script = """ + import multiprocessing + + q = multiprocessing.Queue() + q.put('knock knock') + q.get(timeout=3) + q.close() + del q + """ + with open(filename, 'w') as f: + f.write(textwrap.dedent(script)) + self.addCleanup(test.support.unlink, filename) + + try: + sys.path.append(os.getcwd()) + try: + __import__(module_name) + except pyqueue.Empty: + self.fail("Probable regression on import lock contention;" + " see Issue 22853") + finally: + self.assertEqual(sys.path.pop(), os.getcwd()) + def test_timeout(self): q = multiprocessing.Queue() start = time.time()