Workaround by Tim Peters to skip this test if run from test.autotest,

in which case it will hang because the import lock is already held
by the main thread.
This commit is contained in:
Jack Jansen 2001-08-29 20:26:24 +00:00
parent bf77c465bd
commit 87797872a8

View file

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