Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tox-dev/tox
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4.3.3
Choose a base ref
...
head repository: tox-dev/tox
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4.3.4
Choose a head ref
  • 3 commits
  • 4 files changed
  • 3 contributors

Commits on Jan 17, 2023

  1. Provision cwd (#2877)

    Fix #2876
    masenf authored Jan 17, 2023
    Copy the full SHA
    2a87375 View commit details
  2. Copy the full SHA
    d53f062 View commit details
  3. release 4.3.4

    gaborbernat committed Jan 17, 2023
    Copy the full SHA
    23510dc View commit details
Showing with 34 additions and 2 deletions.
  1. +18 −0 docs/changelog.rst
  2. +1 −1 src/tox/provision.py
  3. +1 −1 src/tox/util/spinner.py
  4. +14 −0 tests/test_provision.py
18 changes: 18 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -4,6 +4,24 @@ Release History

.. towncrier release notes start
v4.3.4 (2023-01-17)
-------------------

Bugfixes - 4.3.4
~~~~~~~~~~~~~~~~
- 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`. (:issue:`2876`)

Misc - 4.3.4
~~~~~~~~~~~~
- :issue:`2878`


v4.3.3 (2023-01-16)
-------------------

2 changes: 1 addition & 1 deletion src/tox/provision.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion src/tox/util/spinner.py
Original file line number Diff line number Diff line change
@@ -138,7 +138,7 @@ def fail(self, key: str) -> None:
def skip(self, key: str) -> None:
self.finalize(key, f"SKIP {self.outcome.skip}", Fore.YELLOW)

def finalize(self, key: str, status: str, color: int) -> None:
def finalize(self, key: str, status: str, color: str) -> None:
start_at = self._envs.pop(key, None)
if self.enabled:
self.clear()
14 changes: 14 additions & 0 deletions tests/test_provision.py
Original file line number Diff line number Diff line change
@@ -212,3 +212,17 @@ def test_provision_plugin_runner_in_provision(tox_project: ToxProjectCreator, tm
proj = tox_project({"tox.ini": "[tox]\nrequires=somepkg123xyz\n[testenv:.tox]\nrunner=example"})
with pytest.raises(KeyError, match="example"):
proj.run("r", "-e", "py", "--result-json", str(log))


@pytest.mark.integration()
@pytest.mark.usefixtures("_pypi_index_self")
@pytest.mark.parametrize("relative_path", [True, False], ids=["relative", "absolute"])
def test_provision_conf_file(tox_project: ToxProjectCreator, tmp_path: Path, relative_path: bool) -> None:
ini = "[tox]\nrequires = demo-pkg-inline\nskipsdist=true\n"
project = tox_project({"tox.ini": ini}, prj_path=tmp_path / "sub")
if relative_path:
conf_path = os.path.join(project.path.name, "tox.ini")
else:
conf_path = str(project.path / "tox.ini")
result = project.run("c", "--conf", conf_path, "-e", "py", from_cwd=tmp_path)
result.assert_success()