Skip to content

Commit

Permalink
run provisioned tox in current working directory instead of {tox_root}
Browse files Browse the repository at this point in the history
running in a different working directory than the parent process changes the
interpretation of relative paths on the command line passed to the provisoned
tox and must be avoided.

fix #2876
  • Loading branch information
masenf committed Jan 17, 2023
1 parent 665c829 commit 376ed04
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/changelog/2876.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
When executing via the provisioning environment (``.tox`` by default), run
``tox`` in working directory of the parent process.

Prior to this change (from tox 4.0.0), the provisioned ``tox`` would execute with
``{tox_root}`` as the working directory, which breaks when a relative path is
passed to ``-c`` or ``--conf`` and ``tox`` is executed in a working directory
other than ``{tox_root}`` - by :user:`masenf`.
2 changes: 1 addition & 1 deletion src/tox/provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,5 @@ def run_provision(name: str, state: State) -> int:
raise HandledError(f"cannot provision tox environment {tox_env.conf['env_name']} because {exception}")
args: list[str] = [str(env_python), "-m", "tox"]
args.extend(state.args)
outcome = tox_env.execute(cmd=args, stdin=StdinSource.user_only(), show=True, run_id="provision")
outcome = tox_env.execute(cmd=args, stdin=StdinSource.user_only(), show=True, run_id="provision", cwd=Path.cwd())
return cast(int, outcome.exit_code)

0 comments on commit 376ed04

Please sign in to comment.