Added edge case code for solving issue 10825

This commit is contained in:
Ardavan Alaei Fard 2023-12-07 00:30:35 -05:00
parent 13024efd7a
commit d17646461c
2 changed files with 21 additions and 0 deletions

View File

@ -340,6 +340,12 @@ class TestReport(BaseReport):
str, str,
TerminalRepr, TerminalRepr,
] = None ] = None
elif call.excinfo and when in ("setup", "teardown"):
outcome = "passed"
longrepr = excinfo
TerminalWriter().write(
msg=f"<Warning! You are using '{when}' file in your code>", Yellow=True
)
else: else:
if not isinstance(excinfo, ExceptionInfo): if not isinstance(excinfo, ExceptionInfo):
outcome = "failed" outcome = "failed"

15
testing/test_setup.py Normal file
View File

@ -0,0 +1,15 @@
def foo():
"""
>>> foo()
'bar'
"""
return "bar"
def setup():
# """
# >>> setup()
# 'ban'
# """
# return "ban"
raise RuntimeError("Setup called!!! Oh No")