Skip to content

Commit

Permalink
Reuse package_env with --installpkg (#2803)
Browse files Browse the repository at this point in the history
Co-authored-by: q0w <43147888+q0w@users.noreply.github.com>
  • Loading branch information
gaborbernat and q0w committed Jan 2, 2023
1 parent 26e293f commit 8244a05
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/changelog/2442.bugfix.rst
@@ -0,0 +1 @@
Reuse package_env with ``--installpkg`` - by :user:`q0w`.
5 changes: 2 additions & 3 deletions src/tox/tox_env/runner.py
Expand Up @@ -87,9 +87,8 @@ def interrupt(self) -> None:
self._call_pkg_envs("interrupt")

def get_package_env_types(self) -> tuple[str, str] | None:
has_external_pkg = getattr(self.options, "install_pkg", None) is not None
if self._register_package_conf() or has_external_pkg:
has_external_pkg = has_external_pkg or self.conf["package"] == "external"
if self._register_package_conf():
has_external_pkg = self.conf["package"] == "external"
self.core.add_config(
keys=["package_env", "isolated_build_env"],
of_type=str,
Expand Down
Expand Up @@ -147,3 +147,14 @@ def test_tox_install_pkg_bad_wheel(tox_project: ToxProjectCreator, tmp_path: Pat

result.assert_failed()
assert "failed with no .dist-info inside " in result.out, result.out


def test_tox_install_pkg_with_skip_install(
tox_project: ToxProjectCreator,
demo_pkg_inline: Path,
demo_pkg_inline_wheel: Path,
) -> None:
ini = "[testenv:foo]\nskip_install = true"
project = tox_project({"tox.ini": ini, "pyproject.toml": (demo_pkg_inline / "pyproject.toml").read_text()})
result = project.run("-e", "py", "--installpkg", str(demo_pkg_inline_wheel))
result.assert_success()

0 comments on commit 8244a05

Please sign in to comment.