summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-10-02 14:25:42 (GMT)
committerBrett Cannon <brett@python.org>2013-10-02 14:25:42 (GMT)
commit634a8fc04276d8215973589d736c8fd372d91b92 (patch)
tree9ee9f961c7ebbc93eb6b19b95f09755a994204fa
parent45163ccce42ddf7840188c0c91e66ceeb28f0e58 (diff)
downloadcpython-634a8fc04276d8215973589d736c8fd372d91b92.zip
cpython-634a8fc04276d8215973589d736c8fd372d91b92.tar.gz
cpython-634a8fc04276d8215973589d736c8fd372d91b92.tar.bz2
Try to fix issue #19134 again
-rw-r--r--Lib/test/test_inspect.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 45b36d2..2b7ba15 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -11,9 +11,12 @@ import shutil
import functools
import importlib
from os.path import normcase
+try:
+ from concurrent.futures import ThreadPoolExecutor
+except ImportError:
+ ThreadPoolExecutor = None
from test.support import run_unittest, TESTFN, DirsOnSysPath
-from test.support import multiprocessing as has_multiprocessing
from test.script_helper import assert_python_ok, assert_python_failure
from test import inspect_fodder as mod
from test import inspect_fodder2 as mod2
@@ -2408,17 +2411,15 @@ class TestMain(unittest.TestCase):
self.assertEqual(lines[:-1], inspect.getsource(module).splitlines())
self.assertEqual(err, b'')
- @unittest.skipIf(not has_multiprocessing,
+ @unittest.skipIf(ThreadPoolExecutor is None,
'multiprocessing required to test __qualname__ for source files')
def test_qualname_source(self):
- module = importlib.import_module('concurrent.futures')
- member = getattr(module, 'ThreadPoolExecutor')
rc, out, err = assert_python_ok('-m', 'inspect',
'concurrent.futures:ThreadPoolExecutor')
lines = out.decode().splitlines()
# ignore the final newline
self.assertEqual(lines[:-1],
- inspect.getsource(member).splitlines())
+ inspect.getsource(ThreadPoolExecutor).splitlines())
self.assertEqual(err, b'')
def test_builtins(self):