summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernát Gábor <bgabor8@bloomberg.net>2021-01-11 11:18:09 +0000
committerBernát Gábor <bgabor8@bloomberg.net>2021-01-11 12:03:54 +0000
commit05c23cb44622024c39cc6e317fa75388aaa3c845 (patch)
tree092d243ecf021a2595ff7d718f3a780646d77b49
parent4cf619a95b2ab14632d2fb6e62335d792da75c37 (diff)
downloadtox-git-05c23cb44622024c39cc6e317fa75388aaa3c845.tar.gz
Adopt same pass env list as tox 3 has
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
-rw-r--r--docs/changelog/1780.bugfix.rst4
-rw-r--r--src/tox/pytest.py4
-rw-r--r--src/tox/tox_env/api.py20
-rw-r--r--src/tox/tox_env/python/api.py5
-rw-r--r--tests/session/cmd/test_show_config.py21
5 files changed, 32 insertions, 22 deletions
diff --git a/docs/changelog/1780.bugfix.rst b/docs/changelog/1780.bugfix.rst
new file mode 100644
index 00000000..929599fe
--- /dev/null
+++ b/docs/changelog/1780.bugfix.rst
@@ -0,0 +1,4 @@
+Adopt tox 3 base pass env list, by adding:
+
+- on all platforms: ``LANG``, ``LANGUAGE``, ``CURL_CA_BUNDLE``, ``SSL_CERT_FILE`` , ``LD_LIBRARY_PATH`` and ``REQUESTS_CA_BUNLDE``,
+- on Windows: ``SYSTEMDRIVE`` - by :user:`gaborbernat`.
diff --git a/src/tox/pytest.py b/src/tox/pytest.py
index a5bdd508..f3c89b9e 100644
--- a/src/tox/pytest.py
+++ b/src/tox/pytest.py
@@ -335,13 +335,13 @@ class ToxRunOutcome:
if dedent:
out = textwrap.dedent(out).lstrip()
if regex:
- self.matches(out, self.out, re.MULTILINE)
+ self.matches(out, self.out, re.MULTILINE | re.DOTALL)
else:
assert self.out == out
if dedent:
err = textwrap.dedent(err).lstrip()
if regex:
- self.matches(err, self.err, re.MULTILINE)
+ self.matches(err, self.err, re.MULTILINE | re.DOTALL)
else:
assert self.err == err
diff --git a/src/tox/tox_env/api.py b/src/tox/tox_env/api.py
index 1ba40a17..e993f02f 100644
--- a/src/tox/tox_env/api.py
+++ b/src/tox/tox_env/api.py
@@ -117,21 +117,29 @@ class ToxEnv(ABC):
def default_pass_env(self) -> List[str]:
env = [
- "https_proxy",
- "http_proxy",
- "no_proxy",
+ "https_proxy", # HTTP proxy configuration
+ "http_proxy", # HTTP proxy configuration
+ "no_proxy", # HTTP proxy configuration
+ "LANG", # localication
+ "LANGUAGE", # localication
+ "CURL_CA_BUNDLE", # curl certificates
+ "SSL_CERT_FILE", # https certificates
+ "LD_LIBRARY_PATH", # location of libs
]
if sys.stdout.isatty(): # if we're on a interactive shell pass on the TERM
env.append("TERM")
if sys.platform == "win32": # pragma: win32 cover
env.extend(
[
- "TEMP",
- "TMP",
+ "TEMP", # temporary file location
+ "TMP", # temporary file location
+ "USERPROFILE", # needed for `os.path.expanduser()`
+ "PATHEXT", # needed for discovering executables
+ "MSYSTEM", # controls paths printed format
]
)
else: # pragma: win32 no cover
- env.append("TMPDIR")
+ env.append("TMPDIR") # temporary file location
return env
def setup(self) -> None:
diff --git a/src/tox/tox_env/python/api.py b/src/tox/tox_env/python/api.py
index ed7dd27d..2e85c951 100644
--- a/src/tox/tox_env/python/api.py
+++ b/src/tox/tox_env/python/api.py
@@ -98,14 +98,13 @@ class Python(ToxEnv, ABC):
if sys.platform == "win32": # pragma: win32 cover
env.extend(
[
+ "SYSTEMDRIVE",
"SYSTEMROOT", # needed for python's crypto module
- "PATHEXT", # needed for discovering executables
"COMSPEC", # needed for distutils cygwin compiler
"PROCESSOR_ARCHITECTURE", # platform.machine()
- "USERPROFILE", # needed for `os.path.expanduser()`
- "MSYSTEM", # controls paths printed format
]
)
+ env.extend(["REQUESTS_CA_BUNDLE"])
return env
def default_base_python(self, conf: "Config", env_name: Optional[str]) -> List[str]:
diff --git a/tests/session/cmd/test_show_config.py b/tests/session/cmd/test_show_config.py
index 3b404e00..4cba562c 100644
--- a/tests/session/cmd/test_show_config.py
+++ b/tests/session/cmd/test_show_config.py
@@ -27,12 +27,6 @@ def test_show_config_default_run_env(tox_project: ToxProjectCreator, monkeypatch
version = re.escape(Version(__version__).public)
monkeypatch.delenv("TERM", raising=False) # disable conditionally set flag
- if sys.platform == "win32": # pragma: win32 cover
- p_env = ["COMSPEC", "MSYSTEM", "PATHEXT", "PROCESSOR_ARCHITECTURE", "SYSTEMROOT", "TEMP", "TMP", "USERPROFILE"]
- else: # pragma: win32 no cover
- p_env = ["TMPDIR"]
- p_env.extend(["PIP_*", "VIRTUALENV_*", "http_proxy", "https_proxy", "no_proxy"])
- pass_env_str = "\n".join(f" {re.escape(p)}" for p in sorted(p_env))[4:]
expected = rf"""
\[testenv:{name}\]
@@ -45,8 +39,8 @@ def test_show_config_default_run_env(tox_project: ToxProjectCreator, monkeypatch
env_name = {name}
env_dir = {path}{sep}\.tox4{sep}{name}
env_tmp_dir = {path}{sep}\.tox4{sep}{name}{sep}tmp
- pass_env =
- {pass_env_str}\
+ pass_env =\
+ .*
parallel_show_output = False
description =
commands = magic
@@ -146,12 +140,17 @@ def test_pass_env_config_default(tox_project: ToxProjectCreator, stdout_is_atty:
project = tox_project({"tox.ini": ""})
outcome = project.run("c", "-e", "py", "-k", "pass_env")
pass_env = outcome.state.tox_env("py").conf["pass_env"]
+ is_win = sys.platform == "win32"
expected = (
- (["COMSPEC", "MSYSTEM", "PATHEXT"] if sys.platform == "win32" else [])
+ (["COMSPEC"] if is_win else [])
+ + ["CURL_CA_BUNDLE", "LANG", "LANGUAGE", "LD_LIBRARY_PATH"]
+ + (["MSYSTEM", "PATHEXT"] if is_win else [])
+ ["PIP_*"]
- + (["PROCESSOR_ARCHITECTURE", "SYSTEMROOT", "TEMP"] if sys.platform == "win32" else [])
+ + (["PROCESSOR_ARCHITECTURE"] if is_win else [])
+ + ["REQUESTS_CA_BUNDLE", "SSL_CERT_FILE"]
+ + (["SYSTEMDRIVE", "SYSTEMROOT", "TEMP"] if is_win else [])
+ (["TERM"] if stdout_is_atty else [])
- + (["TMP", "USERPROFILE"] if sys.platform == "win32" else ["TMPDIR"])
+ + (["TMP", "USERPROFILE"] if is_win else ["TMPDIR"])
+ ["VIRTUALENV_*", "http_proxy", "https_proxy", "no_proxy"]
)
assert pass_env == expected