summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Good <matt@matt-good.net>2013-08-07 09:13:48 -0700
committerMatt Good <matt@matt-good.net>2013-08-07 09:13:48 -0700
commitadb7ee1bf45384438a63a73120d9e449f236e008 (patch)
tree9645f52d10bfe31647260f74ef8839ef3d03984c
parent1b1f00476543609c78ba0159bba846ef4858d7f6 (diff)
downloadtox-adb7ee1bf45384438a63a73120d9e449f236e008.tar.gz
Compute skipsdist default at config parse time
-rw-r--r--tests/test_z_cmdline.py18
-rw-r--r--tox/_cmdline.py7
-rw-r--r--tox/_config.py12
3 files changed, 25 insertions, 12 deletions
diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py
index 777eaa4..5c94251 100644
--- a/tests/test_z_cmdline.py
+++ b/tests/test_z_cmdline.py
@@ -384,6 +384,24 @@ def test_usedevelop(initproj, cmd):
assert not result.ret
assert "sdist-make" not in result.stdout.str()
+def test_usedevelop_mixed(initproj, cmd):
+ initproj("example123", filedefs={'tox.ini': """
+ [testenv:devenv]
+ usedevelop=True
+ [testenv:nondev]
+ usedevelop=False
+ """})
+
+ # running only 'devenv' should not do sdist
+ result = cmd.run("tox", "-vv", "-e", "devenv")
+ assert not result.ret
+ assert "sdist-make" not in result.stdout.str()
+
+ # running all envs should do sdist
+ result = cmd.run("tox", "-vv")
+ assert not result.ret
+ assert "sdist-make" in result.stdout.str()
+
def test_test_usedevelop(cmd, initproj):
initproj("example123-0.5", filedefs={
'tests': {'test_hello.py': """
diff --git a/tox/_cmdline.py b/tox/_cmdline.py
index 414fc15..7b39250 100644
--- a/tox/_cmdline.py
+++ b/tox/_cmdline.py
@@ -400,12 +400,7 @@ class Session:
return sdist_path
def subcommand_test(self):
- skipsdist = self.config.skipsdist
- # if skipsdist is not explicitly set, skip if develop == True
- # for all venvs (either via usedevelop or --develop)
- if skipsdist is None:
- skipsdist = all(venv.envconfig.develop for venv in self.venvlist)
- if skipsdist:
+ if self.config.skipsdist:
self.report.info("skipping sdist step")
sdist_path = None
else:
diff --git a/tox/_config.py b/tox/_config.py
index 5c01af1..0d86f10 100644
--- a/tox/_config.py
+++ b/tox/_config.py
@@ -207,12 +207,6 @@ class parseini:
homedir=config.homedir)
config.toxworkdir = reader.getpath(toxsection, "toxworkdir",
"{toxinidir}/.tox")
- try:
- config.skipsdist = reader.getbool(toxsection, "skipsdist")
- except KeyError:
- # default to None if not set so that we can check the "usedevelop"
- # settings instead
- config.skipsdist = None
config.minversion = reader.getdefault(toxsection, "minversion", None)
# determine indexserver dictionary
@@ -269,6 +263,12 @@ class parseini:
config.envconfigs[name] = \
self._makeenvconfig(name, "_xz_9", reader._subs, config)
+ all_develop = all(name in config.envconfigs
+ and config.envconfigs[name].develop
+ for name in config.envlist)
+
+ config.skipsdist = reader.getbool(toxsection, "skipsdist", all_develop)
+
def _makeenvconfig(self, name, section, subs, config):
vc = VenvConfig(envname=name)
vc.config = config