From 45b78d9ba5306ce385c9fc3982d2f2804fc4354b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 21 Nov 2025 16:35:27 +0100 Subject: [PATCH 1/2] config: Add a test for -o with invalid option (#13980) This was ignored until #13830. With that change, it now gets correctly surfaced to the user as a warning (or error with --strict-config), so we should have a test for it. (cherry picked from commit 9f992b8b61264ef5d010783e0d31b63d859f0071) --- testing/test_config.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/testing/test_config.py b/testing/test_config.py index d28b9110413..423d99c2857 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -2356,7 +2356,14 @@ def test_override_ini_without_config_file(self, pytester: Pytester) -> None: } ) result = pytester.runpytest("--override-ini", "pythonpath=src") - assert result.parseoutcomes() == {"passed": 1} + result.assert_outcomes(passed=1) + + def test_override_ini_invalid_option(self, pytester: Pytester) -> None: + result = pytester.runpytest("--override-ini", "doesnotexist=true") + result.stdout.fnmatch_lines([ + "=*= warnings summary =*=", + "*PytestConfigWarning:*Unknown config option: doesnotexist", + ]) def test_help_via_addopts(pytester: Pytester) -> None: From f1b2ac6fca929d8d3b02c0fdeb6ba6601df18fb3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 21 Nov 2025 15:36:32 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- testing/test_config.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/testing/test_config.py b/testing/test_config.py index 423d99c2857..2556e4e00aa 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -2360,10 +2360,12 @@ def test_override_ini_without_config_file(self, pytester: Pytester) -> None: def test_override_ini_invalid_option(self, pytester: Pytester) -> None: result = pytester.runpytest("--override-ini", "doesnotexist=true") - result.stdout.fnmatch_lines([ - "=*= warnings summary =*=", - "*PytestConfigWarning:*Unknown config option: doesnotexist", - ]) + result.stdout.fnmatch_lines( + [ + "=*= warnings summary =*=", + "*PytestConfigWarning:*Unknown config option: doesnotexist", + ] + ) def test_help_via_addopts(pytester: Pytester) -> None: