diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-08-30 05:16:13 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-08-30 05:16:13 (GMT) |
commit | 692323488baf518117d3ede90189812723f39948 (patch) | |
tree | 8401474367a2c7684060b891da495cfb025e9bd5 /Lib | |
parent | c41418751fcef0a42f336ba91871827b45d558a7 (diff) | |
download | cpython-692323488baf518117d3ede90189812723f39948.zip cpython-692323488baf518117d3ede90189812723f39948.tar.gz cpython-692323488baf518117d3ede90189812723f39948.tar.bz2 |
Add a new function imp.lock_held(), and use it to skip test_threaded_import
when that test is doomed to deadlock.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_threaded_import.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/test_threaded_import.py b/Lib/test/test_threaded_import.py index 1e1c553..e022c5f 100644 --- a/Lib/test/test_threaded_import.py +++ b/Lib/test/test_threaded_import.py @@ -32,10 +32,12 @@ 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") + + import imp + if imp.lock_held(): + # This triggers on, e.g., from test import autotest. + raise TestSkipped("can't run when import lock is held") + done.acquire() for N in (20, 50) * 3: if verbose: |