py36+: remove _pytest.compat.MODULE_NOT_FOUND_ERROR
This commit is contained in:
parent
325b988ca8
commit
1f57fb079d
|
@ -46,11 +46,6 @@ class NotSetType(enum.Enum):
|
|||
NOTSET = NotSetType.token # type: Final # noqa: E305
|
||||
# fmt: on
|
||||
|
||||
MODULE_NOT_FOUND_ERROR = (
|
||||
"ModuleNotFoundError" if sys.version_info[:2] >= (3, 6) else "ImportError"
|
||||
)
|
||||
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from importlib import metadata as importlib_metadata
|
||||
else:
|
||||
|
|
|
@ -210,9 +210,6 @@ class TestGeneralUsage:
|
|||
"""
|
||||
)
|
||||
result = testdir.runpytest()
|
||||
exc_name = (
|
||||
"ModuleNotFoundError" if sys.version_info >= (3, 6) else "ImportError"
|
||||
)
|
||||
assert result.stdout.lines == []
|
||||
assert result.stderr.lines == [
|
||||
"ImportError while loading conftest '{}'.".format(conftest),
|
||||
|
@ -220,7 +217,7 @@ class TestGeneralUsage:
|
|||
" foo()",
|
||||
"conftest.py:2: in foo",
|
||||
" import qwerty",
|
||||
"E {}: No module named 'qwerty'".format(exc_name),
|
||||
"E ModuleNotFoundError: No module named 'qwerty'",
|
||||
]
|
||||
|
||||
def test_early_skip(self, testdir):
|
||||
|
|
|
@ -1383,13 +1383,10 @@ class TestImportModeImportlib:
|
|||
"""
|
||||
self.setup_conftest_and_foo(testdir)
|
||||
result = testdir.runpytest("-v", "--import-mode=importlib")
|
||||
exc_name = (
|
||||
"ModuleNotFoundError" if sys.version_info[:2] > (3, 5) else "ImportError"
|
||||
)
|
||||
result.stdout.fnmatch_lines(
|
||||
[
|
||||
"*{}: No module named 'foo'".format(exc_name),
|
||||
"tests?test_foo.py:2: {}".format(exc_name),
|
||||
"*ModuleNotFoundError: No module named 'foo'",
|
||||
"tests?test_foo.py:2: ModuleNotFoundError",
|
||||
"* 1 failed in *",
|
||||
]
|
||||
)
|
||||
|
|
|
@ -4,7 +4,6 @@ from typing import Callable
|
|||
from typing import Optional
|
||||
|
||||
import pytest
|
||||
from _pytest.compat import MODULE_NOT_FOUND_ERROR
|
||||
from _pytest.doctest import _get_checker
|
||||
from _pytest.doctest import _is_mocked
|
||||
from _pytest.doctest import _is_setup_py
|
||||
|
@ -399,8 +398,8 @@ class TestDoctests:
|
|||
result.stdout.fnmatch_lines(
|
||||
[
|
||||
"*>>> import asdals*",
|
||||
"*UNEXPECTED*{e}*".format(e=MODULE_NOT_FOUND_ERROR),
|
||||
"{e}: No module named *asdal*".format(e=MODULE_NOT_FOUND_ERROR),
|
||||
"*UNEXPECTED*ModuleNotFoundError*",
|
||||
"ModuleNotFoundError: No module named *asdal*",
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -423,7 +422,7 @@ class TestDoctests:
|
|||
result.stdout.fnmatch_lines(
|
||||
[
|
||||
"*ERROR collecting hello.py*",
|
||||
"*{e}: No module named *asdals*".format(e=MODULE_NOT_FOUND_ERROR),
|
||||
"*ModuleNotFoundError: No module named *asdals*",
|
||||
"*Interrupted: 1 error during collection*",
|
||||
]
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue