New submission from STINNER Victor: test.support.import_module() catchs ModuleNotFoundError instead of ImportError since the following changeset:
changeset: 84106:c4d7228421df user: Brett Cannon <br...@python.org> date: Wed Jun 12 20:12:30 2013 -0400 files: Lib/test/regrtest.py Lib/test/support.py Lib/test/test___all__.py Lib/xmlrpc/server.py Lib/zipfile.py description: Move test___all__ over to unittest.main() and use ModuleNotFoundError The problem is that multiprocessing.synchronize raises an ImportError if _multiprocess.SemLock does not exist: # Try to import the mp.synchronize module cleanly, if it fails # raise ImportError for platforms lacking a working sem_open implementation. # See issue 3770 try: from X_multiprocessing import SemLock except (ImportError): raise ImportError("This platform lacks a functioning sem_open" + " implementation, therefore, the required" + " synchronization primitives needed will not" + " function, see issue 3770.") As a result, test_multiprocessing is no more skipped on FreeBSD 6.4, but the following traceback is written: http://buildbot.python.org/all/builders/x86%20FreeBSD%206.4%203.x/builds/3771/steps/test/logs/stdio Re-running test 'test_multiprocessing' in verbose mode test test_multiprocessing crashed -- Traceback (most recent call last): File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/multiprocessing/synchronize.py", line 27, in <module> from _multiprocessing import SemLock ModuleNotFoundError: cannot import name SemLock During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/test/regrtest.py", line 1300, in runtest_inner the_module = importlib.import_module(abstest) File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/importlib/__init__.py", line 93, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1614, in _gcd_import File "<frozen importlib._bootstrap>", line 1595, in _find_and_load File "<frozen importlib._bootstrap>", line 1562, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 609, in _check_name_wrapper File "<frozen importlib._bootstrap>", line 1058, in load_module File "<frozen importlib._bootstrap>", line 928, in load_module File "<frozen importlib._bootstrap>", line 274, in _call_with_frames_removed File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/test/test_multiprocessing.py", line 30, in <module> test.support.import_module('multiprocessing.synchronize') File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/test/support.py", line 123, in import_module return importlib.import_module(name) File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/importlib/__init__.py", line 93, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1614, in _gcd_import File "<frozen importlib._bootstrap>", line 1595, in _find_and_load File "<frozen importlib._bootstrap>", line 1562, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 609, in _check_name_wrapper File "<frozen importlib._bootstrap>", line 1058, in load_module File "<frozen importlib._bootstrap>", line 928, in load_module File "<frozen importlib._bootstrap>", line 274, in _call_with_frames_removed File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/multiprocessing/synchronize.py", line 32, in <module> " function, see issue 3770.") ImportError: This platform lacks a functioning sem_open implementation, therefore, the required synchronization primitives needed will not function, see issue 3770. ---------- messages: 191876 nosy: brett.cannon, haypo, sbt priority: normal severity: normal status: open title: test_multiprocessing: test.support.import_module() does not ignore the ImportError on SemLock versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18302> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com