Skip to content

[PR #14443/a481f264 backport][9.0.x] Fix strict options from addopts#14449

Merged
bluetech merged 1 commit into9.0.xfrom
patchback/backports/9.0.x/a481f264d70ac3d053d5f7408f4ac1ec439d0c2f/pr-14443
May 9, 2026
Merged

[PR #14443/a481f264 backport][9.0.x] Fix strict options from addopts#14449
bluetech merged 1 commit into9.0.xfrom
patchback/backports/9.0.x/a481f264d70ac3d053d5f7408f4ac1ec439d0c2f/pr-14443

Conversation

@patchback
Copy link
Copy Markdown

@patchback patchback Bot commented May 8, 2026

This is a backport of PR #14443 as merged into main (a481f26).

Closes #14442

This fixes a pytest 9 regression where --strict-markers and
--strict-config were ignored when configured through addopts

addopts is parsed after the initial config discovery step, so the
OverrideIniAction compatibility path updated the parsed argparse namespace,
but the generated ini overrides were not applied back into _inicfg

As a result, later getini() calls still saw the default values for
strict_markers and strict_config

This change applies parsed ini overrides after parsing the full argument list
including addopts, and clears the ini cache so later getini() calls use the
updated values

Added regression coverage for:

  • --strict-config from addopts
  • --strict-markers from addopts

Tested with:

python -m pytest -q \
  testing/test_config.py::TestParseIni::test_strict_config_from_addopts \
  testing/test_mark.py::test_strict_markers_from_addopts

python -m pytest -q \
  testing/test_config.py::TestParseIni::test_invalid_config_options \
  testing/test_mark.py::test_strict_prohibits_unregistered_markers

Closes #14442

(cherry picked from commit a481f26)
@bluetech bluetech merged commit 6507c70 into 9.0.x May 9, 2026
60 of 62 checks passed
@bluetech bluetech deleted the patchback/backports/9.0.x/a481f264d70ac3d053d5f7408f4ac1ec439d0c2f/pr-14443 branch May 9, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants