summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernat Gabor <gaborjbernat@gmail.com>2018-09-14 14:47:08 +0100
committerBernát Gábor <gaborjbernat@gmail.com>2018-09-14 19:37:32 +0300
commit16fdcead2096c6885e9c9ac086ba4e11e8ccf45b (patch)
treebe0926b1bdd2ccc62c5690bc11d31cc9bfe21a8f
parent5b520fa40ef740f071ea7658e8338c798d580f8a (diff)
downloadtox-git-16fdcead2096c6885e9c9ac086ba4e11e8ccf45b.tar.gz
do not build sdist if skip install specified for target envs
in this case we'll not test the sdist either way, so might as well bystep the work of producing it
-rw-r--r--changelog/974.feature.rst1
-rw-r--r--src/tox/session.py7
-rw-r--r--tests/unit/session/test_session.py38
-rw-r--r--tests/unit/test_z_cmdline.py20
4 files changed, 43 insertions, 23 deletions
diff --git a/changelog/974.feature.rst b/changelog/974.feature.rst
new file mode 100644
index 00000000..dc98f074
--- /dev/null
+++ b/changelog/974.feature.rst
@@ -0,0 +1 @@
+do not build sdist if skip install is specified for the envs to be run - by :user:`gaborbernat`
diff --git a/src/tox/session.py b/src/tox/session.py
index ae6eb283..5ac0c7d3 100644
--- a/src/tox/session.py
+++ b/src/tox/session.py
@@ -522,9 +522,10 @@ class Session:
self.report.info("skipping sdist step")
else:
for venv in self.venvlist:
- venv.package = self.hook.tox_package(session=self, venv=venv)
- if not venv.package:
- return 2
+ if not venv.envconfig.skip_install:
+ venv.package = self.hook.tox_package(session=self, venv=venv)
+ if not venv.package:
+ return 2
if self.config.option.sdistonly:
return
for venv in self.venvlist:
diff --git a/tests/unit/session/test_session.py b/tests/unit/session/test_session.py
index 61125fac..90b1b992 100644
--- a/tests/unit/session/test_session.py
+++ b/tests/unit/session/test_session.py
@@ -102,3 +102,41 @@ def test_tox_parallel_build_safe(initproj, cmd, mock_venv):
basename = path.basename
assert basename.startswith(base)
assert uuid.UUID(basename[len(base) :], version=4)
+
+
+def test_skip_sdist(cmd, initproj):
+ initproj(
+ "pkg123-0.7",
+ filedefs={
+ "tests": {"test_hello.py": "def test_hello(): pass"},
+ "setup.py": """
+ syntax error
+ """,
+ "tox.ini": """
+ [tox]
+ skipsdist=True
+ [testenv]
+ commands=python -c "print('done')"
+ """,
+ },
+ )
+ result = cmd()
+ assert result.ret == 0
+
+
+def test_skip_install_skip_package(cmd, initproj, mock_venv):
+ initproj(
+ "pkg123-0.7",
+ filedefs={
+ "setup.py": """raise RuntimeError""",
+ "tox.ini": """
+ [tox]
+ envlist = py
+
+ [testenv]
+ skip_install = true
+ """,
+ },
+ )
+ result = cmd("--notest")
+ assert result.ret == 0
diff --git a/tests/unit/test_z_cmdline.py b/tests/unit/test_z_cmdline.py
index 65c9a61e..a864af56 100644
--- a/tests/unit/test_z_cmdline.py
+++ b/tests/unit/test_z_cmdline.py
@@ -303,26 +303,6 @@ def test_unknown_environment(cmd, initproj):
assert result.out == "ERROR: unknown environment 'qpwoei'\n"
-def test_skip_sdist(cmd, initproj):
- initproj(
- "pkg123-0.7",
- filedefs={
- "tests": {"test_hello.py": "def test_hello(): pass"},
- "setup.py": """
- syntax error
- """,
- "tox.ini": """
- [tox]
- skipsdist=True
- [testenv]
- commands=python -c "print('done')"
- """,
- },
- )
- result = cmd()
- assert result.ret == 0
-
-
def test_minimal_setup_py_empty(cmd, initproj):
initproj(
"pkg123-0.7",