]> granicus.if.org Git - python/commitdiff
Workaround by Tim Peters to skip this test if run from test.autotest,
authorJack Jansen <jack.jansen@cwi.nl>
Wed, 29 Aug 2001 20:26:24 +0000 (20:26 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Wed, 29 Aug 2001 20:26:24 +0000 (20:26 +0000)
in which case it will hang because the import lock is already held
by the main thread.

Lib/test/test_threaded_import.py

index fafb8737de416823cff4b473c909b79039ce12df..1e1c55321f9260c575e0b33d1d6a93e08d2dca52 100644 (file)
@@ -6,7 +6,7 @@
 # randrange, and then Python hangs.
 
 import thread
-from test_support import verbose
+from test_support import verbose, TestSkipped
 
 critical_section = thread.allocate_lock()
 done = thread.allocate_lock()
@@ -32,6 +32,10 @@ def task():
 
 def test_main():        # magic name!  see above
     global N, done
+    import sys
+    for modname in sys.modules:
+        if modname.find('autotest') >= 0:
+            raise TestSkipped("can't run from autotest")
     done.acquire()
     for N in (20, 50) * 3:
         if verbose: