From 4b18e42671bfaeb07a557d7eee1a1f8ca817f8ea Mon Sep 17 00:00:00 2001 From: Antoine DECHAUME Date: Wed, 5 May 2021 00:04:05 +0200 Subject: [PATCH 1/3] Fix when there is no 4th arg passed to build_isolated --- CONTRIBUTORS | 1 + src/tox/helper/build_isolated.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index a3f3f646b..38e8700e0 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -9,6 +9,7 @@ Andrii Soldatenko Andrzej Klajnert Anthon van der Neuth Anthony Sottile +Antoine Dechaume Anudit Nagar Ashley Whetter Asmund Grammeltwedt diff --git a/src/tox/helper/build_isolated.py b/src/tox/helper/build_isolated.py index 3d897097c..4c57c5734 100644 --- a/src/tox/helper/build_isolated.py +++ b/src/tox/helper/build_isolated.py @@ -29,7 +29,7 @@ def _ensure_module_in_paths(module, paths): dist_folder = sys.argv[1] backend_spec = sys.argv[2] backend_obj = sys.argv[3] if len(sys.argv) >= 4 else None -backend_paths = sys.argv[4].split(os.path.pathsep) if sys.argv[4] else [] +backend_paths = sys.argv[4].split(os.path.pathsep) if (len(sys.argv) >= 5 and sys.argv[4]) else [] sys.path[:0] = backend_paths From 4a6c1533e1857f923d74904dd7599e47cb56077d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Wed, 5 May 2021 09:14:46 +0100 Subject: [PATCH 2/3] Add changelog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernát Gábor --- docs/changelog/2056.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/changelog/2056.bugfix.rst diff --git a/docs/changelog/2056.bugfix.rst b/docs/changelog/2056.bugfix.rst new file mode 100644 index 000000000..16d1f7b13 --- /dev/null +++ b/docs/changelog/2056.bugfix.rst @@ -0,0 +1 @@ +Fix a ``tox-conda`` isolation build bug - by :user:`AntoineD`. From d55a524d63b5ba68abd9a7b278a48403faee0e1b Mon Sep 17 00:00:00 2001 From: Antoine DECHAUME Date: Wed, 5 May 2021 15:28:16 +0200 Subject: [PATCH 3/3] Add a test case --- .../package/builder/test_package_builder_isolated.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/unit/package/builder/test_package_builder_isolated.py b/tests/unit/package/builder/test_package_builder_isolated.py index 458e43bbe..dd783d855 100644 --- a/tests/unit/package/builder/test_package_builder_isolated.py +++ b/tests/unit/package/builder/test_package_builder_isolated.py @@ -1,8 +1,10 @@ import os +import subprocess import py import pytest +import tox.helper from tox.package.builder.isolated import get_build_info from tox.reporter import _INSTANCE @@ -193,3 +195,10 @@ def test_verbose_isolated_build_in_tree(initproj, mock_venv, cmd): assert "running sdist" in result.out, result.out assert "running egg_info" in result.out, result.out assert "Writing example123-0.5{}setup.cfg".format(os.sep) in result.out, result.out + + +def test_isolated_build_script_args(tmp_path): + """Verify that build_isolated.py can be called with only 2 argurments.""" + # cannot import build_isolated because of its side effects + script_path = os.path.join(os.path.dirname(tox.helper.__file__), "build_isolated.py") + subprocess.check_call(("python", script_path, str(tmp_path), "setuptools.build_meta"))