From 0f8cd4ce4a7f942d793a8670257f8738ab18b757 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Thu, 23 Nov 2023 23:52:27 -0500 Subject: [PATCH] Treat XPASS status as a test failure This causes full "failure" output to be printed when a test marked xfail unexpectedly passes, and for the test run to be considered failing as a result. The immediate purpose of this change is to facilitate efficient identification of recently introduced wrong or overbroad xfail markings. This behavior may eventually become the pytest default (see #1728 and references therein), and this could be retained even after the current xpassing tests are investigated, to facilitate timely detection of tests marked xfail of code that is newly working. (Individual tests decorated `@pytest.mark.xfail` can still be allowed to unexpectedly pass without it being treated like a test failure, by passing strict=False explicitly.) --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 7109389d7..5c3117096 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,6 +8,7 @@ filterwarnings = "ignore::DeprecationWarning" python_files = "test_*.py" tmp_path_retention_policy = "failed" testpaths = "test" # Space separated list of paths from root e.g test tests doc/testing. +xfail_strict = true # Treat the XPASS status as a test failure (unless strict=False is passed). # --cov coverage # --cov-report term # send report to terminal term-missing -> terminal with line numbers html xml # --cov-report term-missing # to terminal with line numbers