Fix strict options from addopts#14443
Conversation
The-Compiler
left a comment
There was a problem hiding this comment.
Thanks! I can't comment much about the approach you took here (I'd like to defer that to e.g. @bluetech), but I added two suggestions.
| ) | ||
|
|
||
| self._inicfg.update(parse_override_ini(self.known_args_namespace.override_ini)) | ||
| self._inicache.clear() |
There was a problem hiding this comment.
Why run this a second time here? I don't see how pytest_addoption could somehow influence addopts.
If this is needed, can you please add a test to demonstrate that?
| result.stdout.fnmatch_lines( | ||
| ["'unregisteredmark' not found in `markers` configuration option"] | ||
| ) | ||
| assert result.ret != pytest.ExitCode.OK |
There was a problem hiding this comment.
I'd suggest matching on the actual return value, like in the other test you added.
d18dd84 to
3ce8f74
Compare
|
@The-Compiler Thanks for the review I originally added the second I removed the second update to keep the change scoped to the failing case Also updated marker regression test to assert the exact exit code |
Closes #14442
This fixes a pytest 9 regression where
--strict-markersand--strict-configwere ignored when configured throughaddoptsaddoptsis parsed after the initial config discovery step, so theOverrideIniActioncompatibility path updated the parsed argparse namespace,but the generated ini overrides were not applied back into
_inicfgAs a result, later
getini()calls still saw the default values forstrict_markersandstrict_configThis change applies parsed ini overrides after parsing the full argument list
including
addopts, and clears the ini cache so latergetini()calls use theupdated values
Added regression coverage for:
--strict-configfromaddopts--strict-markersfromaddoptsTested with: