๐Ÿ› fix(config): use inipath for TOML file discovery by gaborbernat ยท Pull Request #190 ยท pytest-dev/pytest-env

@gaborbernat changed the title Fix TOML config walk starting from inipath ๐Ÿ› fix(config): start TOML walk from inipath

Feb 11, 2026

@gaborbernat

When pytest resolves config to a subdirectory (e.g. tests_integration/pytest.toml),
rootpath still points to the project root. This caused the parent pyproject.toml
to be found first, ignoring the subdirectory's pytest_env config.

Starting from inipath.parent ensures the walk begins at the directory of the
resolved config file, finding the correct pytest_env section. Falls back to
rootpath when no config file is found.

@gaborbernat

@gaborbernat gaborbernat changed the title ๐Ÿ› fix(config): start TOML walk from inipath ๐Ÿ› fix(config): use inipath for TOML file discovery

Feb 11, 2026