2 new commits in tox: https://bitbucket.org/hpk42/tox/commits/77fe073adf32/ Changeset: 77fe073adf32 User: mgood Date: 2013-08-07 02:28:33 Summary: 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. Affected #: 5 files diff -r bfa0702aae2488ce8f7530e1e9d80b66de3d0256 -r 77fe073adf323caa25cae8c4ccbe4f8c0ff729a5 doc/config.txt --- a/doc/config.txt +++ b/doc/config.txt @@ -22,7 +22,6 @@ 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 @@ 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 -r bfa0702aae2488ce8f7530e1e9d80b66de3d0256 -r 77fe073adf323caa25cae8c4ccbe4f8c0ff729a5 doc/example/general.txt --- a/doc/example/general.txt +++ b/doc/example/general.txt @@ -166,7 +166,7 @@ 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 -r bfa0702aae2488ce8f7530e1e9d80b66de3d0256 -r 77fe073adf323caa25cae8c4ccbe4f8c0ff729a5 tests/test_z_cmdline.py --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -377,7 +377,7 @@ def test_usedevelop(initproj, cmd): initproj("example123", filedefs={'tox.ini': """ - [tox] + [testenv] usedevelop=True """}) result = cmd.run("tox", "-vv") @@ -392,9 +392,8 @@ """, }, 'tox.ini': ''' - [tox] + [testenv] usedevelop=True - [testenv] changedir=tests commands= py.test --basetemp={envtmpdir} --junitxml=junit-{envname}.xml [] diff -r bfa0702aae2488ce8f7530e1e9d80b66de3d0256 -r 77fe073adf323caa25cae8c4ccbe4f8c0ff729a5 tox/_cmdline.py --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -400,7 +400,12 @@ 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 @@ 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 @@ 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 @@ 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 -r bfa0702aae2488ce8f7530e1e9d80b66de3d0256 -r 77fe073adf323caa25cae8c4ccbe4f8c0ff729a5 tox/_config.py --- a/tox/_config.py +++ b/tox/_config.py @@ -207,10 +207,12 @@ 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 @@ 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): https://bitbucket.org/hpk42/tox/commits/d31aad39e16f/ Changeset: d31aad39e16f User: mgood Date: 2013-08-07 18:13:48 Summary: Compute skipsdist default at config parse time Affected #: 3 files diff -r 77fe073adf323caa25cae8c4ccbe4f8c0ff729a5 -r d31aad39e16f4e3b397a0b131834b50a1c265c48 tests/test_z_cmdline.py --- a/tests/test_z_cmdline.py +++ b/tests/test_z_cmdline.py @@ -384,6 +384,24 @@ 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 -r 77fe073adf323caa25cae8c4ccbe4f8c0ff729a5 -r d31aad39e16f4e3b397a0b131834b50a1c265c48 tox/_cmdline.py --- a/tox/_cmdline.py +++ b/tox/_cmdline.py @@ -400,12 +400,7 @@ 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 -r 77fe073adf323caa25cae8c4ccbe4f8c0ff729a5 -r d31aad39e16f4e3b397a0b131834b50a1c265c48 tox/_config.py --- a/tox/_config.py +++ b/tox/_config.py @@ -207,12 +207,6 @@ 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 @@ 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 Repository URL: https://bitbucket.org/hpk42/tox/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ pytest-commit mailing list pytest-commit@python.org http://mail.python.org/mailman/listinfo/pytest-commit