-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot dynamically mark a test as xfail #3100
Comments
GitMate.io thinks the contributor most likely able to help you is @RonnyPfannschmidt. |
please report if my guess was correct |
I want to be able to mark a test as xfail, and then let it run, and have a possibility of generating a XPASS result |
ah, it looks like run=True is the trick! This will work for me, but the xtest_dynamic_xfail_set_during_setup case is more natural for me Why is xtest_dynamic_xfail_set_during_setup disabled? |
according to the history 8 years ago when |
i'm closing as the actual question seems to be answered, in case something is missing please call out and thanks |
is there a ticket for re-enabling xtest_dynamic_xfail_set_during_setup ? |
no, alos that test uses a mechanism which instead of modifying the collected test, it modifies the function of the test (which may be used in different tests as part of the upcoming mark cleanup we are going to remove that mechanism eventually (with some deprecation grace periods |
this is due to XFAIL This is stderr |
For other users who end up here, the following appears to work, def test_something(request):
if some_dynamic_condition:
request.applymarker(pytest.mark.xfail(run=False))
# continue running the code below in any case
some_other_code() It might be helpful to have this as part of the docs. |
From inside a test, the test cannot be marked as xfail (or xpass)
This is useful when particular test combinations are invalid.
I believe the test
xtest_dynamic_xfail_set_during_setup
covers this case, but by starting withxtest
, it is not being run. I have not found any documented reason for its exclusion, nor a ticket that addresses.The text was updated successfully, but these errors were encountered: