summaryrefslogtreecommitdiffstats
path: root/Lib/test/support.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-06-13 00:12:30 (GMT)
committerBrett Cannon <brett@python.org>2013-06-13 00:12:30 (GMT)
commitc9a1bfed5d820b681debca52554fea76ba0a9ae0 (patch)
treeba3c9fd41acbffaa32bf6e09a323471778064be7 /Lib/test/support.py
parent603dcf27140ca109d11496eb4a57fe6440ddc915 (diff)
downloadcpython-c9a1bfed5d820b681debca52554fea76ba0a9ae0.zip
cpython-c9a1bfed5d820b681debca52554fea76ba0a9ae0.tar.gz
cpython-c9a1bfed5d820b681debca52554fea76ba0a9ae0.tar.bz2
Move test___all__ over to unittest.main() and use ModuleNotFoundError
Diffstat (limited to 'Lib/test/support.py')
-rw-r--r--Lib/test/support.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py
index 97de608..9baedb4 100644
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -29,27 +29,27 @@ import _testcapi
try:
import _thread, threading
-except ImportError:
+except ModuleNotFoundError:
_thread = None
threading = None
try:
import multiprocessing.process
-except ImportError:
+except ModuleNotFoundError:
multiprocessing = None
try:
import zlib
-except ImportError:
+except ModuleNotFoundError:
zlib = None
try:
import bz2
-except ImportError:
+except ModuleNotFoundError:
bz2 = None
try:
import lzma
-except ImportError:
+except ModuleNotFoundError:
lzma = None
__all__ = [
@@ -116,7 +116,7 @@ def import_module(name, deprecated=False, *, required_on=()):
with _ignore_deprecated_imports(deprecated):
try:
return importlib.import_module(name)
- except ImportError as msg:
+ except ModuleNotFoundError as msg:
if sys.platform.startswith(tuple(required_on)):
raise
raise unittest.SkipTest(str(msg))
@@ -188,7 +188,7 @@ def import_fresh_module(name, fresh=(), blocked=(), deprecated=False):
if not _save_and_block_module(blocked_name, orig_modules):
names_to_remove.append(blocked_name)
fresh_module = importlib.import_module(name)
- except ImportError:
+ except ModuleNotFoundError:
fresh_module = None
finally:
for orig_name, module in orig_modules.items():