diff options
author | Matt Good <matt@matt-good.net> | 2013-08-06 17:28:33 -0700 |
---|---|---|
committer | Matt Good <matt@matt-good.net> | 2013-08-06 17:28:33 -0700 |
commit | 1b1f00476543609c78ba0159bba846ef4858d7f6 (patch) | |
tree | f2809f4fb7894a5337f8893d368a2221fe99a1b1 | |
parent | cad98436acf645bdb01044e299ce0304e1964b42 (diff) | |
download | tox-1b1f00476543609c78ba0159bba846ef4858d7f6.tar.gz |
Make "usedevelop" a [testenv] setting instead of a [tox] setting
Enables setting "usedevelop" per virtualenv. If "[tox]skipsdist" is not explicitly set, it default to True if all environments in the current envlist have develop = True.
-rw-r--r-- | doc/config.txt | 9 | ||||
-rw-r--r-- | doc/example/general.txt | 2 | ||||
-rw-r--r-- | tests/test_z_cmdline.py | 5 | ||||
-rw-r--r-- | tox/_cmdline.py | 11 | ||||
-rw-r--r-- | tox/_config.py | 12 |
5 files changed, 26 insertions, 13 deletions
diff --git a/doc/config.txt b/doc/config.txt index c0f262a..0cfef42 100644 --- a/doc/config.txt +++ b/doc/config.txt @@ -22,7 +22,6 @@ List of optional global options:: distshare=path # defaults to {homedir}/.tox/distshare envlist=ENVLIST # defaults to the list of all environments skipsdist=BOOL # defaults to false - usedevelop=BOOL # use python setup.py develop, defaults to false ``tox`` autodetects if it is running in a Jenkins_ context @@ -186,6 +185,14 @@ Complete list of settings that you can put into ``testenv*`` sections: would be treated as relative to ``{toxinidir}``. **default**: ``{toxworkdir}/{envname}`` +.. confval:: usedevelop=BOOL + + .. versionadded:: 1.6 + + Install the current package in development mode with "setup.py develop" + instead of installing from the ``sdist`` package. + **default**: ``False`` + Substitutions --------------------- diff --git a/doc/example/general.txt b/doc/example/general.txt index 7179a87..b7aab37 100644 --- a/doc/example/general.txt +++ b/doc/example/general.txt @@ -166,7 +166,7 @@ to deal with it in your commands section:: Running setup.py develop is a common enough model that it has its own option:: - [tox] + [testenv] usedevelop=True And a corresponding command line option ``--develop``, which will set diff --git a/tests/test_z_cmdline.py b/tests/test_z_cmdline.py index 8cc0e85..777eaa4 100644 --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -377,7 +377,7 @@ def test_develop(initproj, cmd): def test_usedevelop(initproj, cmd): initproj("example123", filedefs={'tox.ini': """ - [tox] + [testenv] usedevelop=True """}) result = cmd.run("tox", "-vv") @@ -392,9 +392,8 @@ def test_test_usedevelop(cmd, initproj): """, }, 'tox.ini': ''' - [tox] - usedevelop=True [testenv] + usedevelop=True changedir=tests commands= py.test --basetemp={envtmpdir} --junitxml=junit-{envname}.xml [] diff --git a/tox/_cmdline.py b/tox/_cmdline.py index b205eab..414fc15 100644 --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -400,7 +400,12 @@ class Session: return sdist_path def subcommand_test(self): - if self.config.skipsdist: + 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: self.report.info("skipping sdist step") sdist_path = None else: @@ -411,7 +416,7 @@ class Session: return for venv in self.venvlist: if self.setupenv(venv): - if self.config.usedevelop or self.config.option.develop: + if venv.envconfig.develop: self.developpkg(venv, self.config.setupdir) elif self.config.skipsdist: self.finishvenv(venv) @@ -462,7 +467,6 @@ class Session: self.report.keyvalue("setupdir: ", self.config.setupdir) self.report.keyvalue("distshare: ", self.config.distshare) self.report.keyvalue("skipsdist: ", self.config.skipsdist) - self.report.keyvalue("usedevelop: ", self.config.usedevelop) self.report.tw.line() for envconfig in self.config.envconfigs.values(): self.report.line("[testenv:%s]" % envconfig.envname, bold=True) @@ -479,6 +483,7 @@ class Session: self.report.line(" deps=%s" % envconfig.deps) self.report.line(" envdir= %s" % envconfig.envdir) self.report.line(" downloadcache=%s" % envconfig.downloadcache) + self.report.line(" usedevelop=%s" % envconfig.develop) def showenvs(self): for env in self.config.envlist: diff --git a/tox/_config.py b/tox/_config.py index 009b92f..5c01af1 100644 --- a/tox/_config.py +++ b/tox/_config.py @@ -207,10 +207,12 @@ class parseini: homedir=config.homedir) config.toxworkdir = reader.getpath(toxsection, "toxworkdir", "{toxinidir}/.tox") - config.usedevelop = reader.getbool(toxsection, "usedevelop", False) - config.skipsdist = reader.getbool(toxsection, "skipsdist", - config.usedevelop - or config.option.develop) + 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 @@ -272,7 +274,7 @@ class parseini: vc.config = config reader = IniReader(self._cfg, fallbacksections=["testenv"]) reader.addsubstitions(**subs) - vc.develop = config.usedevelop or config.option.develop + vc.develop = reader.getbool(section, "usedevelop", config.option.develop) vc.envdir = reader.getpath(section, "envdir", "{toxworkdir}/%s" % name) vc.args_are_paths = reader.getbool(section, "args_are_paths", True) if reader.getdefault(section, "python", None): |