Apply suggestions from @bluetech
This commit is contained in:
parent
5ebcb34fb5
commit
95bd232e57
|
@ -29,7 +29,6 @@ from _pytest.mark.structures import Mark
|
||||||
from _pytest.mark.structures import MarkDecorator
|
from _pytest.mark.structures import MarkDecorator
|
||||||
from _pytest.mark.structures import NodeKeywords
|
from _pytest.mark.structures import NodeKeywords
|
||||||
from _pytest.outcomes import fail
|
from _pytest.outcomes import fail
|
||||||
from _pytest.outcomes import Failed
|
|
||||||
from _pytest.store import Store
|
from _pytest.store import Store
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
@ -332,19 +331,15 @@ class Node(metaclass=NodeMeta):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _repr_failure_py(
|
def _repr_failure_py(
|
||||||
self,
|
self, excinfo: ExceptionInfo[BaseException], style=None,
|
||||||
excinfo: ExceptionInfo[
|
|
||||||
Union[Failed, FixtureLookupError, ConftestImportFailure]
|
|
||||||
],
|
|
||||||
style=None,
|
|
||||||
) -> Union[str, ReprExceptionInfo, ExceptionChainRepr, FixtureLookupErrorRepr]:
|
) -> Union[str, ReprExceptionInfo, ExceptionChainRepr, FixtureLookupErrorRepr]:
|
||||||
|
if isinstance(excinfo.value, ConftestImportFailure):
|
||||||
|
excinfo = ExceptionInfo(excinfo.value.excinfo)
|
||||||
if isinstance(excinfo.value, fail.Exception):
|
if isinstance(excinfo.value, fail.Exception):
|
||||||
if not excinfo.value.pytrace:
|
if not excinfo.value.pytrace:
|
||||||
return str(excinfo.value)
|
return str(excinfo.value)
|
||||||
if isinstance(excinfo.value, FixtureLookupError):
|
if isinstance(excinfo.value, FixtureLookupError):
|
||||||
return excinfo.value.formatrepr()
|
return excinfo.value.formatrepr()
|
||||||
if isinstance(excinfo.value, ConftestImportFailure):
|
|
||||||
excinfo = ExceptionInfo(excinfo.value.excinfo) # type: ignore
|
|
||||||
if self.config.getoption("fulltrace", False):
|
if self.config.getoption("fulltrace", False):
|
||||||
style = "long"
|
style = "long"
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -404,9 +404,7 @@ class TestReportSerialization:
|
||||||
result.stdout.fnmatch_lines(
|
result.stdout.fnmatch_lines(
|
||||||
["E ModuleNotFoundError: No module named 'unknown'"]
|
["E ModuleNotFoundError: No module named 'unknown'"]
|
||||||
)
|
)
|
||||||
result.stdout.no_fnmatch_line(
|
result.stdout.no_fnmatch_line("ERROR - *ConftestImportFailure*")
|
||||||
"ERROR - _pytest.config.ConftestImportFailure: ModuleNotFoundError:*"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class TestHooks:
|
class TestHooks:
|
||||||
|
|
Loading…
Reference in New Issue