Open lengau opened 11 months ago
Hi @lengau,
Thanks for the issue!
Unfortunately I'm not sure about it.
I agree that strict xfail
should always be preferred to non-strict, but it is probably better to set it globally in the config file, instead of bugging developers with lint errors on each individual test.
There already is issue #24 which suggests to verify that the config file follows the best practices (including xfail_strict = True
)
the plan in pytest is to make xfail strict by default again
Rule request
Description
Detect use of the
@pytest.mark.xfail
decorator and ensure it explicitly sets astrict=True
orstrict=False
rather than allowing silent (and possibly accidental) use of the defaultFalse
configuration.Rationale
The
pytest.mark.xfail
decorator has astrict
parameter that defaults toFalse
, makingxfail
in CI roughly equivalent to askip
rather than failing if the test passes. This would prevent accidentally committingxfail
tests that get hidden in CI.