Skip to content

Conversation

@bluetech
Copy link
Member

Currently ini overrides are handled lazily in getini, but I think it just complicates things and I don't see a reason to do it lazily.

Do it eagerly in determine_setup instead.

inicfg.update(ini_overrides)

assert rootdir is not None
return rootdir, inipath, inicfg or {}, ignored_config_files
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated cleanup, the or isn't needed.

@bluetech bluetech added the skip news used on prs to opt out of the changelog requirement label Oct 19, 2025
Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Perhaps mention this in a trivial changelog just in case there is a corner case affected by this?

Currently ini overrides are handled lazily in `getini`, but I think it
just complicates things and I don't see a reason to it lazily.

Do it eagerly in `determine_setup` instead.
@bluetech bluetech force-pushed the simplify-override-ini branch from 44a7fc8 to 15c2e19 Compare October 21, 2025 13:34
@bluetech
Copy link
Member Author

Perhaps mention this in a trivial changelog just in case there is a corner case affected by this?

We don't have "trivial" but I added a "misc" one.

@bluetech bluetech merged commit 0877d57 into pytest-dev:main Oct 21, 2025
33 checks passed
@bluetech bluetech deleted the simplify-override-ini branch October 21, 2025 13:53
@The-Compiler
Copy link
Member

The-Compiler commented Nov 17, 2025

FWIW, this also changes behavior (in a good way!). Before this change, pytest -o doesnotexist=true would silently ignore the option without complaining at all. After this, it shows as a warning/error as expected.

We should probably have a test for this, will try to follow up tomorrow.

edit: #13980

The-Compiler added a commit to The-Compiler/pytest that referenced this pull request Nov 18, 2025
This was ignored until pytest-dev#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.
nicoddemus pushed a commit that referenced this pull request Nov 21, 2025
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.
patchback bot pushed a commit that referenced this pull request Nov 21, 2025
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 9f992b8)
nicoddemus pushed a commit that referenced this pull request Nov 21, 2025
…nvalid option (#13994)

* 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 9f992b8)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Florian Bruhin <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news used on prs to opt out of the changelog requirement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants