From 2b05faff0a0172dbc74b81f47528e56ad608839e Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 1 May 2020 14:40:17 +0300 Subject: Improve types around repr_failure() --- src/_pytest/skipping.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/_pytest/skipping.py') diff --git a/src/_pytest/skipping.py b/src/_pytest/skipping.py index 54621f111..bbd4593fd 100644 --- a/src/_pytest/skipping.py +++ b/src/_pytest/skipping.py @@ -148,7 +148,8 @@ def pytest_runtest_makereport(item: Item, call: CallInfo[None]): elif item.config.option.runxfail: pass # don't interfere - elif call.excinfo and call.excinfo.errisinstance(xfail.Exception): + elif call.excinfo and isinstance(call.excinfo.value, xfail.Exception): + assert call.excinfo.value.msg is not None rep.wasxfail = "reason: " + call.excinfo.value.msg rep.outcome = "skipped" elif evalxfail and not rep.skipped and evalxfail.wasvalid() and evalxfail.istrue(): -- cgit v1.2.3