From a3d3918a3253a99ad81e2e6e7862c58df19a8f37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Tue, 3 Jun 2025 11:08:56 +0200 Subject: [PATCH] testing: Explicitly pass `-Werror` to tests needing it Explicitly pass `-Werror` to `runpytester()` in the few additional tests needing it, in order to fix test failures when the test suite is run with `-Wdefault` or a similar override. Fixes #13480 --- changelog/13480.bugfix.rst | 1 + testing/test_threadexception.py | 2 +- testing/test_warnings.py | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelog/13480.bugfix.rst diff --git a/changelog/13480.bugfix.rst b/changelog/13480.bugfix.rst new file mode 100644 index 00000000000..ed649a33516 --- /dev/null +++ b/changelog/13480.bugfix.rst @@ -0,0 +1 @@ +Fixed a few test failures in pytest's own test suite when run with ``-Wdefault`` or a similar override. diff --git a/testing/test_threadexception.py b/testing/test_threadexception.py index 5dad07b8b85..f4595ec435d 100644 --- a/testing/test_threadexception.py +++ b/testing/test_threadexception.py @@ -211,7 +211,7 @@ def test_it(request): """ ) - result = pytester.runpytest() + result = pytester.runpytest("-Werror") # TODO: should be a test failure or error assert result.ret == pytest.ExitCode.INTERNAL_ERROR diff --git a/testing/test_warnings.py b/testing/test_warnings.py index c302e7c6e3c..b1c64dc9332 100644 --- a/testing/test_warnings.py +++ b/testing/test_warnings.py @@ -149,6 +149,7 @@ def test_func(fix): ) +@pytest.mark.skip("issue #13485") def test_works_with_filterwarnings(pytester: Pytester) -> None: """Ensure our warnings capture does not mess with pre-installed filters (#2430).""" pytester.makepyfile(