From ae5c370737bb99ed9344059622209c05aff575f2 Mon Sep 17 00:00:00 2001 From: "Ryan S. Brown" Date: Tue, 5 Dec 2017 16:36:24 -0500 Subject: [PATCH] Fail hard when tests pass that are expected to fail `@pytest.mark.xfail()` can be used to decorate tests that don't yet pass. By default, if I wrote a test like this: ``` @pytest.mark.xfail() def test_naughty(): assert 1 == 1 ``` Then Pytest would allow this test to pass without notifying that an expected-fail *didn't* fail. To make that happen, you have to set xfail_strict=True so that the above test would cause the tests to fail. --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index 2e936c49659..d86c38965a8 100644 --- a/tox.ini +++ b/tox.ini @@ -20,6 +20,8 @@ passenv = # variable error. See issue: #20424 HOME +[pytest] +xfail_strict = true [flake8] # These are things that the devs don't agree make the code more readable