Trying to determine if test has been an expected fail. #10255
Unanswered
f00dog-x300
asked this question in
Q&A
Replies: 1 comment 3 replies
-
It seems @pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item):
outcome = yield
rep = outcome.get_result()
rep.xfailed = False
if hasattr(rep, "wasxfail"):
if rep.passed:
rep.xfailed = True # unexpected pass
setattr(item, "rep_" + rep.when, rep) |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to see if the test that was run was failed due to an assertion or if it was failed because of an expected fail.
I can't find any documentation on how to do that, but I have been using
request.node.rep_call.failed
to check if a test was failed and set a variable (test_result
) as "failed." However, I cannot find anything on how to check if the call was an xfail. Can someone help me? The above was a feeble attempt to try to figure out it.Beta Was this translation helpful? Give feedback.
All reactions