unittest: add clarifying comment on unittest.SkipTest -> pytest.skip code
I was tempted to remove it, until I figured out why it was there.
This commit is contained in:
parent
addbd3161e
commit
096bae6c68
|
@ -343,6 +343,10 @@ def pytest_runtest_makereport(item: Item, call: CallInfo[None]) -> None:
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Convert unittest.SkipTest to pytest.skip.
|
||||||
|
# This is actually only needed for nose, which reuses unittest.SkipTest for
|
||||||
|
# its own nose.SkipTest. For unittest TestCases, SkipTest is already
|
||||||
|
# handled internally, and doesn't reach here.
|
||||||
unittest = sys.modules.get("unittest")
|
unittest = sys.modules.get("unittest")
|
||||||
if (
|
if (
|
||||||
unittest
|
unittest
|
||||||
|
@ -350,7 +354,6 @@ def pytest_runtest_makereport(item: Item, call: CallInfo[None]) -> None:
|
||||||
and isinstance(call.excinfo.value, unittest.SkipTest) # type: ignore[attr-defined]
|
and isinstance(call.excinfo.value, unittest.SkipTest) # type: ignore[attr-defined]
|
||||||
):
|
):
|
||||||
excinfo = call.excinfo
|
excinfo = call.excinfo
|
||||||
# Let's substitute the excinfo with a pytest.skip one.
|
|
||||||
call2 = CallInfo[None].from_call(
|
call2 = CallInfo[None].from_call(
|
||||||
lambda: pytest.skip(str(excinfo.value)), call.when
|
lambda: pytest.skip(str(excinfo.value)), call.when
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue