Fix 'None' failure report for tests with pytest.fail(pytrace=False)
This commit is contained in:
parent
61f7c27ec0
commit
f53b1fa550
1
AUTHORS
1
AUTHORS
|
@ -13,6 +13,7 @@ Ahn Ki-Wook
|
|||
Akiomi Kamakura
|
||||
Alan Velasco
|
||||
Alessio Izzo
|
||||
Alex Jones
|
||||
Alexander Johnson
|
||||
Alexander King
|
||||
Alexei Kozlenok
|
||||
|
|
|
@ -627,7 +627,7 @@ class ExceptionInfo(Generic[E]):
|
|||
Ignored if ``style=="native"``.
|
||||
|
||||
:param str style:
|
||||
long|short|no|native|value traceback style.
|
||||
long|short|line|no|native|value traceback style.
|
||||
|
||||
:param bool abspath:
|
||||
If paths should be changed to absolute or left unchanged.
|
||||
|
|
|
@ -445,7 +445,7 @@ class Node(metaclass=NodeMeta):
|
|||
if isinstance(excinfo.value, ConftestImportFailure):
|
||||
excinfo = ExceptionInfo.from_exc_info(excinfo.value.excinfo)
|
||||
if isinstance(excinfo.value, fail.Exception):
|
||||
if not excinfo.value.pytrace:
|
||||
if not excinfo.value.pytrace and style != "line":
|
||||
style = "value"
|
||||
if isinstance(excinfo.value, FixtureLookupError):
|
||||
return excinfo.value.formatrepr()
|
||||
|
|
|
@ -1539,6 +1539,18 @@ class TestGenericReporting:
|
|||
s = result.stdout.str()
|
||||
assert "def test_func2" not in s
|
||||
|
||||
def test_tb_crashline_pytrace_false(self, pytester: Pytester, option) -> None:
|
||||
pytester.makepyfile(
|
||||
"""
|
||||
import pytest
|
||||
def test_func1():
|
||||
pytest.fail('test_func1', pytrace=False)
|
||||
"""
|
||||
)
|
||||
result = pytester.runpytest("--tb=line")
|
||||
s = result.stdout.str()
|
||||
assert "None" not in s
|
||||
|
||||
def test_pytest_report_header(self, pytester: Pytester, option) -> None:
|
||||
pytester.makeconftest(
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue