Repository navigation
Create change_dir before running the external package build command - #4095
Merged
gaborbernat merged 3 commits intoSep 26, 2026
Merged
Conversation
The external package builder is the only one of the four change_dir call sites that does not create the directory first. The documented behaviour for the external builder says it will be created, and the three siblings (session/cmd/run/single.py, tox_env/runner.py and tox_env/python/runner.py) all do it. Without it, pointing change_dir at a directory that does not exist yet fails the whole run with "No such file or directory" from the subprocess layer, while the same change_dir on a run env works.
for more information, see https://pre-commit.ci
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The external package builder is the only one of the four
change_dircall sites that does not create the directory before running commands in it.The documentation for the external builder's
change_dirstates the opposite:The three siblings all do it, one line above their
run_command_setcall:session/cmd/run/single.py:89tox_env/runner.py:176tox_env/python/runner.py:213tox_env/python/virtual_env/package/cmd_builder.py:87Without it, pointing
change_dirat a directory that does not exist yet fails the whole run from the subprocess layer:while the same
change_diron a run env creates the directory and works.The fix is the same line the siblings use. The added test asserts the directory exists after the run, and it fails on
mainwithassert PosixPath('.../build-here').is_dir().tests/tox_env/python/virtual_env/package/test_package_cmd_builder.pyis 11 passed, 2 skipped (the two integration cases).ruff checkandruff format --checkare clean with the 0.16.8 pinned in.pre-commit-config.yaml.I will add the
docs/changelog/entry as soon as this PR has a number.