Skip to content

Commit 8244a05

Browse files
gaborbernatq0w
andauthored
Reuse package_env with --installpkg (#2803)
Co-authored-by: q0w <[email protected]>
1 parent 26e293f commit 8244a05

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

docs/changelog/2442.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Reuse package_env with ``--installpkg`` - by :user:`q0w`.

src/tox/tox_env/runner.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,8 @@ def interrupt(self) -> None:
8787
self._call_pkg_envs("interrupt")
8888

8989
def get_package_env_types(self) -> tuple[str, str] | None:
90-
has_external_pkg = getattr(self.options, "install_pkg", None) is not None
91-
if self._register_package_conf() or has_external_pkg:
92-
has_external_pkg = has_external_pkg or self.conf["package"] == "external"
90+
if self._register_package_conf():
91+
has_external_pkg = self.conf["package"] == "external"
9392
self.core.add_config(
9493
keys=["package_env", "isolated_build_env"],
9594
of_type=str,

tests/tox_env/python/virtual_env/package/test_package_cmd_builder.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,14 @@ def test_tox_install_pkg_bad_wheel(tox_project: ToxProjectCreator, tmp_path: Pat
147147

148148
result.assert_failed()
149149
assert "failed with no .dist-info inside " in result.out, result.out
150+
151+
152+
def test_tox_install_pkg_with_skip_install(
153+
tox_project: ToxProjectCreator,
154+
demo_pkg_inline: Path,
155+
demo_pkg_inline_wheel: Path,
156+
) -> None:
157+
ini = "[testenv:foo]\nskip_install = true"
158+
project = tox_project({"tox.ini": ini, "pyproject.toml": (demo_pkg_inline / "pyproject.toml").read_text()})
159+
result = project.run("-e", "py", "--installpkg", str(demo_pkg_inline_wheel))
160+
result.assert_success()

0 commit comments

Comments
 (0)