1 new commit in tox: https://bitbucket.org/hpk42/tox/commits/9416611f7bf9/ Changeset: 9416611f7bf9 User: hpk42 Date: 2015-06-19 09:37:08+00:00 Summary: introduce a TOX_TESTENV_PASSENV setting which is honored when constructing the set of environment variables for test environments. Affected #: 6 files
diff -r 6d2c16ca341567fc5976a22834c9908777033f93 -r 9416611f7bf93c4c85bb48ed2f5f4fe4f3151f97 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,10 @@ - allow envlist to be a multi-line list, to intersperse comments and have long envlist settings split more naturally. Thanks Andre Caron. +- introduce a TOX_TESTENV_PASSENV setting which is honored + when constructing the set of environment variables for test environments. + Thanks Marc Abramowitz for pushing in this direction. + 2.0.2 ---------- diff -r 6d2c16ca341567fc5976a22834c9908777033f93 -r 9416611f7bf93c4c85bb48ed2f5f4fe4f3151f97 setup.py --- a/setup.py +++ b/setup.py @@ -48,7 +48,7 @@ description='virtualenv-based automation of test activities', long_description=open("README.rst").read(), url='http://tox.testrun.org/', - version='2.1.0.dev1', + version='2.1.0.dev2', license='http://opensource.org/licenses/MIT', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], author='holger krekel', diff -r 6d2c16ca341567fc5976a22834c9908777033f93 -r 9416611f7bf93c4c85bb48ed2f5f4fe4f3151f97 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -789,6 +789,18 @@ assert "CB21" not in config.envconfigs["x2"].passenv assert "BX23" not in config.envconfigs["x2"].passenv + def test_passenv_from_global_env(self, tmpdir, newconfig, monkeypatch): + monkeypatch.setenv("A1", "a1") + monkeypatch.setenv("A2", "a2") + monkeypatch.setenv("TOX_TESTENV_PASSENV", "A1") + config = newconfig(""" + [testenv] + passenv = A2 + """) + env = config.envconfigs["python"] + assert "A1" in env.passenv + assert "A2" in env.passenv + def test_changedir_override(self, tmpdir, newconfig): config = newconfig(""" [testenv] diff -r 6d2c16ca341567fc5976a22834c9908777033f93 -r 9416611f7bf93c4c85bb48ed2f5f4fe4f3151f97 tox/__init__.py --- a/tox/__init__.py +++ b/tox/__init__.py @@ -1,5 +1,5 @@ # -__version__ = '2.1.0.dev1' +__version__ = '2.1.0.dev2' from .hookspecs import hookspec, hookimpl # noqa diff -r 6d2c16ca341567fc5976a22834c9908777033f93 -r 9416611f7bf93c4c85bb48ed2f5f4fe4f3151f97 tox/config.py --- a/tox/config.py +++ b/tox/config.py @@ -295,9 +295,9 @@ dest="recreate", help="force recreation of virtual environments") parser.add_argument("--result-json", action="store", - dest="resultjson", metavar="PATH", - help="write a json file with detailed information about " - "all commands and results involved.") + dest="resultjson", metavar="PATH", + help="write a json file with detailed information " + "about all commands and results involved.") # We choose 1 to 4294967295 because it is the range of PYTHONHASHSEED. parser.add_argument("--hashseed", action="store", @@ -388,6 +388,11 @@ passenv = set(["PATH", "PIP_INDEX_URL", "LANG"]) + # read in global passenv settings + p = os.environ.get("TOX_TESTENV_PASSENV", None) + if p is not None: + passenv.update(x for x in p.split() if x) + # we ensure that tmp directory settings are passed on # we could also set it to the per-venv "envtmpdir" # but this leads to very long paths when run with jenkins diff -r 6d2c16ca341567fc5976a22834c9908777033f93 -r 9416611f7bf93c4c85bb48ed2f5f4fe4f3151f97 tox/session.py --- a/tox/session.py +++ b/tox/session.py @@ -46,6 +46,12 @@ tw = py.io.TerminalWriter() tw.write(config._parser._format_help()) tw.line() + tw.line("Environment variables", bold=True) + tw.line("TOXENV: comma separated list of environments " + "(overridable by '-e')") + tw.line("TOX_TESTENV_PASSENV: space-separated list of extra " + "environment variables to be passed into test command " + "environemnts") def show_help_ini(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 https://mail.python.org/mailman/listinfo/pytest-commit