Skip to content

Commit ae7a32a

Browse files
committed
Check for *Error instead of ImportError in tests
This tests originally checked for ImportError. Since Python 3.6 ModuleNotFoundError is raised in this context instead, the test didn't work as it is text based (so exception inheritance does not save the day). The test now simply checks for any *Error, which makes it less specific, but still valuable. Fixes pytest-dev#2132
1 parent da40bcf commit ae7a32a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

testing/test_doctest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ def test_doctest_unex_importerror_only_txt(self, testdir):
211211
# doctest is never executed because of error during hello.py collection
212212
result.stdout.fnmatch_lines([
213213
"*>>> import asdals*",
214-
"*UNEXPECTED*ImportError*",
215-
"ImportError: No module named *asdal*",
214+
"*UNEXPECTED*Error*",
215+
"*Error: No module named *asdal*",
216216
])
217217

218218
def test_doctest_unex_importerror_with_module(self, testdir):
@@ -227,7 +227,7 @@ def test_doctest_unex_importerror_with_module(self, testdir):
227227
# doctest is never executed because of error during hello.py collection
228228
result.stdout.fnmatch_lines([
229229
"*ERROR collecting hello.py*",
230-
"*ImportError: No module named *asdals*",
230+
"*Error: No module named *asdals*",
231231
"*Interrupted: 1 errors during collection*",
232232
])
233233

0 commit comments

Comments
 (0)