diff options
-rw-r--r-- | CHANGELOG | 4 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | tests/test_config.py | 12 | ||||
-rw-r--r-- | tox/__init__.py | 2 | ||||
-rw-r--r-- | tox/config.py | 11 | ||||
-rw-r--r-- | tox/session.py | 6 |
6 files changed, 32 insertions, 5 deletions
@@ -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 ---------- @@ -48,7 +48,7 @@ def main(): 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 --git a/tests/test_config.py b/tests/test_config.py index 248f1d6..8aa7abd 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -789,6 +789,18 @@ class TestConfigTestEnv: 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 --git a/tox/__init__.py b/tox/__init__.py index 3034588..e3872ec 100644 --- 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 --git a/tox/config.py b/tox/config.py index 177bfcc..092de2a 100644 --- a/tox/config.py +++ b/tox/config.py @@ -295,9 +295,9 @@ def tox_addoption(parser): 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 @@ def tox_addoption(parser): 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 --git a/tox/session.py b/tox/session.py index 37d6b5c..b00465b 100644 --- a/tox/session.py +++ b/tox/session.py @@ -46,6 +46,12 @@ def show_help(config): 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): |