diff options
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: |