Skip to content

Commit 9f992b8

Browse files
authored
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.
1 parent 1b5200c commit 9f992b8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

testing/test_config.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2356,7 +2356,14 @@ def test_override_ini_without_config_file(self, pytester: Pytester) -> None:
23562356
}
23572357
)
23582358
result = pytester.runpytest("--override-ini", "pythonpath=src")
2359-
assert result.parseoutcomes() == {"passed": 1}
2359+
result.assert_outcomes(passed=1)
2360+
2361+
def test_override_ini_invalid_option(self, pytester: Pytester) -> None:
2362+
result = pytester.runpytest("--override-ini", "doesnotexist=true")
2363+
result.stdout.fnmatch_lines([
2364+
"=*= warnings summary =*=",
2365+
"*PytestConfigWarning:*Unknown config option: doesnotexist",
2366+
])
23602367

23612368

23622369
def test_help_via_addopts(pytester: Pytester) -> None:

0 commit comments

Comments
 (0)