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/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`. 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 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"))