diff options
author | Monty Taylor <mordred@inaugust.com> | 2013-07-10 16:22:16 -0400 |
---|---|---|
committer | Monty Taylor <mordred@inaugust.com> | 2013-07-10 16:22:16 -0400 |
commit | fe772b4f5fea2b508bd29b4e82ac6fb9ba06a049 (patch) | |
tree | ae59b779ca6d556b1180ba2494e5bff5be78026d | |
parent | 08c2aaac036791e2be8b0e634d722ba0971b5216 (diff) | |
download | tox-fe772b4f5fea2b508bd29b4e82ac6fb9ba06a049.tar.gz |
Add option to skip sdist step.
First change in a sequence to allow for customization of operational
steps. The sdist creation is current unconditional, which for some
projects makes running tests unreasonably slow. For instance, OpenStack
would prefer to just have python setup.py develop run - but we'd like
to put in the support in a flexible way that will allow people to
express the pipeline needs of their project.
-rw-r--r-- | doc/config.txt | 1 | ||||
-rw-r--r-- | tests/test_z_cmdline.py | 17 | ||||
-rw-r--r-- | tox/_cmdline.py | 18 | ||||
-rw-r--r-- | tox/_config.py | 1 |
4 files changed, 31 insertions, 6 deletions
diff --git a/doc/config.txt b/doc/config.txt index 0964146..9a72abf 100644 --- a/doc/config.txt +++ b/doc/config.txt @@ -21,6 +21,7 @@ List of optional global options:: distdir=path # defaults to {toxworkdir}/dist distshare=path # defaults to {homedir}/.tox/distshare envlist=ENVLIST # defaults to the list of all environments + skipsdist=BOOL # defaults to false ``tox`` autodetects if it is running in a Jenkins_ context diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py index 0208443..12628e3 100644 --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -252,6 +252,23 @@ def test_unknown_environment(cmd, initproj): "*ERROR*unknown*environment*qpwoei*", ]) +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=echo done + ''' + }) + result = cmd.run("tox", ) + assert result.ret == 0 + def test_sdist_fails(cmd, initproj): initproj("pkg123-0.7", filedefs={ 'tests': {'test_hello.py': "def test_hello(): pass"}, diff --git a/tox/_cmdline.py b/tox/_cmdline.py index e34d84f..97a3230 100644 --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -362,19 +362,24 @@ class Session: return sdist_path def subcommand_test(self): - sdist_path = self.sdist() - if not sdist_path: - return 2 + if self.config.skipsdist: + self.report.info("skipping sdist step") + sdist_path = None + else: + sdist_path = self.sdist() + if not sdist_path: + return 2 if self.config.option.sdistonly: return for venv in self.venvlist: if self.setupenv(venv): - self.installpkg(venv, sdist_path) - self.runtestenv(venv, sdist_path) + if not self.config.skipsdist: + self.installpkg(venv, sdist_path) + self.runtestenv(venv) retcode = self._summary() return retcode - def runtestenv(self, venv, sdist_path, redirect=False): + def runtestenv(self, venv, redirect=False): if not self.config.option.notest: if venv.status: return @@ -408,6 +413,7 @@ class Session: self.report.keyvalue("toxworkdir: ", self.config.toxworkdir) self.report.keyvalue("setupdir: ", self.config.setupdir) self.report.keyvalue("distshare: ", self.config.distshare) + self.report.keyvalue("skipsdist: ", self.config.skipsdist) self.report.tw.line() for envconfig in self.config.envconfigs.values(): self.report.line("[testenv:%s]" % envconfig.envname, bold=True) diff --git a/tox/_config.py b/tox/_config.py index 78d5fcd..96eb4c1 100644 --- a/tox/_config.py +++ b/tox/_config.py @@ -194,6 +194,7 @@ class parseini: homedir=config.homedir) config.toxworkdir = reader.getpath(toxsection, "toxworkdir", "{toxinidir}/.tox") + config.skipsdist = reader.getbool(toxsection, "skipsdist", False) config.minversion = reader.getdefault(toxsection, "minversion", None) # determine indexserver dictionary |