Skip to content

Commit

Permalink
Fix when there is no 4th arg passed to build_isolated (#2056)
Browse files Browse the repository at this point in the history
Co-authored-by: Antoine DECHAUME <antoine.dechaume@irt-saintexupery.com>
Co-authored-by: Bernát Gábor <gaborjbernat@gmail.com>
  • Loading branch information
3 people committed May 5, 2021
1 parent 726a275 commit 95cec46
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Expand Up @@ -9,6 +9,7 @@ Andrii Soldatenko
Andrzej Klajnert
Anthon van der Neuth
Anthony Sottile
Antoine Dechaume
Anudit Nagar
Ashley Whetter
Asmund Grammeltwedt
Expand Down
1 change: 1 addition & 0 deletions docs/changelog/2056.bugfix.rst
@@ -0,0 +1 @@
Fix a ``tox-conda`` isolation build bug - by :user:`AntoineD`.
2 changes: 1 addition & 1 deletion src/tox/helper/build_isolated.py
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions 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

Expand Down Expand Up @@ -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"))

0 comments on commit 95cec46

Please sign in to comment.