Skip to content

Commit 0ad23a7

Browse files
committed
Use ImportError in Python 3.5
1 parent b1caefe commit 0ad23a7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

testing/test_collection.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1423,10 +1423,13 @@ def test_modules_not_importable_as_side_effect(self, testdir):
14231423
"""
14241424
self.setup_conftest_and_foo(testdir)
14251425
result = testdir.runpytest("-v", "--import-mode=importlib")
1426+
exc_name = (
1427+
"ModuleNotFoundError" if sys.version_info[:2] > (3, 5) else "ImportError"
1428+
)
14261429
result.stdout.fnmatch_lines(
14271430
[
1428-
"*ModuleNotFoundError: No module named 'foo'",
1429-
"tests?test_foo.py:2: ModuleNotFoundError",
1431+
"*{}: No module named 'foo'".format(exc_name),
1432+
"tests?test_foo.py:2: {}".format(exc_name),
14301433
"* 1 failed in *",
14311434
]
14321435
)

0 commit comments

Comments
 (0)