diff options
author | Bernát Gábor <gaborjbernat@gmail.com> | 2018-10-08 13:34:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-08 13:34:17 +0100 |
commit | 47b298ce2a9a1a758b0ccd35cb1180e70e637145 (patch) | |
tree | d04d7891a9e5d6e610bb2d8245809cc151452bdf | |
parent | 6f8a1f0a31bb126840c28b46f35be3b2ab61b9b7 (diff) | |
download | tox-git-47b298ce2a9a1a758b0ccd35cb1180e70e637145.tar.gz |
bugfix specifying --installpkg breaks build with 3.5.0 (#1043)
Resolves #1042.
cc @suutari
<!-- updated by rtd-bot -->
URL of RTD document: https://tox.readthedocs.io/en/1042/
-rw-r--r-- | docs/changelog/1042.bugfix.rst | 1 | ||||
-rw-r--r-- | src/tox/package.py | 6 | ||||
-rw-r--r-- | tests/unit/test_package.py | 15 |
3 files changed, 19 insertions, 3 deletions
diff --git a/docs/changelog/1042.bugfix.rst b/docs/changelog/1042.bugfix.rst new file mode 100644 index 00000000..250208f3 --- /dev/null +++ b/docs/changelog/1042.bugfix.rst @@ -0,0 +1 @@ +fix regression with ``3.5.0``: specifying ``--installpkg`` raises ``AttributeError: 'str' object has no attribute 'basename'`` diff --git a/src/tox/package.py b/src/tox/package.py index bbd191fd..29548c65 100644 --- a/src/tox/package.py +++ b/src/tox/package.py @@ -108,9 +108,9 @@ def get_local_package(config, report, session): path = config.option.installpkg if not path: path = config.sdistsrc - path = session._resolve_package(path) - report.info("using package {!r}, skipping 'sdist' activity ".format(str(path))) - return path + py_path = py.path.local(session._resolve_package(path)) + report.info("using package {!r}, skipping 'sdist' activity ".format(str(py_path))) + return py_path def build_package(config, report, session): diff --git a/tests/unit/test_package.py b/tests/unit/test_package.py index d46d229d..e4c39a48 100644 --- a/tests/unit/test_package.py +++ b/tests/unit/test_package.py @@ -389,3 +389,18 @@ def test_tox_parallel_build_safe(initproj, cmd, mock_venv, monkeypatch): assert len(dist_after) == 1 sdist = dist_after[0] assert t1_package != sdist + + +def test_install_via_installpkg(mock_venv, initproj, cmd): + base = initproj( + "pkg-0.1", + filedefs={ + "tox.ini": """ + [tox] + install_cmd = python -m -c 'print("ok")' -- {opts} {packages}' + """ + }, + ) + fake_package = base.ensure(".tox", "dist", "pkg123-0.1.zip") + result = cmd("-e", "py", "--notest", "--installpkg", str(fake_package.relto(base))) + assert result.ret == 0, result.out |