You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yep. That will happen if using the standard pytest.xfail() function.
The reason is that the implementation of pytest.xfail() is to raise an exception. See implementation.
The xfail() function doesn't just mark the test as xfail, it raises an exception and stops the test.
The workarounds are.
Use the @pytest.mark.xfail decorator on the function if you know the test function is always xfail.
If you need some collection time logic to determine xfail-ness, use the condition parameter to @pytest.mark.xfail().
If you need to determine xfail-ness at test runtime, then try using the pytest-runtime-xfail plugin and the runtime_xfail fixture. You still may need to call the function before the check.is_true() is called, but honestly I don't remember.
Hello!
When i call the method
pytest.xfail()
the test is marked as XFAIL:But if before calling the method
pytest.xfail()
any of the methods pytest_check returns false, then the test is marked as failed:The text was updated successfully, but these errors were encountered: