Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/changelog/3600.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Previously, when tox ran in an automatically provisioned environment, it could hang waiting for a PEP 517 build backend
if used in conjunction with the ``--installpkg`` option. This has been fixed by properly tearing down the automatically
provisioned environment after the tests.
- by :user:`vytas7`
12 changes: 8 additions & 4 deletions src/tox/provision.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,14 @@ def run_provision(name: str, state: State) -> int:
logging.info("will run in a automatically provisioned python environment under %s", env_python)
try:
tox_env.setup()
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", cwd=Path.cwd()
)
return cast("int", outcome.exit_code)
except Skip as exception:
msg = f"cannot provision tox environment {tox_env.conf['env_name']} because {exception}"
raise HandledError(msg) from 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", cwd=Path.cwd())
return cast("int", outcome.exit_code)
finally:
tox_env.teardown()
3 changes: 2 additions & 1 deletion src/tox/tox_env/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ def mark_active_run_env(self, run_env: RunToxEnv) -> None:
self._envs.add(run_env.conf.name)

def teardown_env(self, conf: EnvConfigSet) -> None:
self._envs.remove(conf.name)
if conf.name in self._envs:
self._envs.remove(conf.name)
if len(self._envs) == 0:
self._teardown()

Expand Down