launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28321
[Merge] ~cjwatson/lpcraft:tox-pass-proxy-env into lpcraft:main
Colin Watson has proposed merging ~cjwatson/lpcraft:tox-pass-proxy-env into lpcraft:main.
Commit message:
tox plugin: Pass through lower-case proxy environment variables
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/lpcraft/+git/lpcraft/+merge/419131
launchpad-buildd sets `http_proxy` and `https_proxy`, but tox 3.24.5 only passes through the upper-case versions. This is fixed in development versions of tox (https://github.com/tox-dev/tox/issues/2372), but work around it for now.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/lpcraft:tox-pass-proxy-env into lpcraft:main.
diff --git a/NEWS.rst b/NEWS.rst
index 0786b15..6f0abb0 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -5,7 +5,9 @@ Version history
0.0.7 (unreleased)
====================
-- Nothing yet.
+- tox plugin: Work around https://github.com/tox-dev/tox/issues/2372 by
+ telling ``tox`` to pass through lower-case ``http_proxy`` and
+ ``https_proxy`` environment variables.
0.0.6 (2022-04-05)
====================
diff --git a/lpcraft/plugin/tests/test_plugins.py b/lpcraft/plugin/tests/test_plugins.py
index d8872a5..f7c2012 100644
--- a/lpcraft/plugin/tests/test_plugins.py
+++ b/lpcraft/plugin/tests/test_plugins.py
@@ -60,7 +60,7 @@ class TestPlugins(CommandBaseTestCase):
"apache2",
],
cwd=PosixPath("/root/project"),
- env={"PLUGIN": "tox"},
+ env={"TOX_TESTENV_PASSENV": "http_proxy https_proxy"},
stdout=ANY,
stderr=ANY,
),
@@ -73,7 +73,7 @@ class TestPlugins(CommandBaseTestCase):
"python3 -m pip install tox==3.24.5; tox",
],
cwd=PosixPath("/root/project"),
- env={"PLUGIN": "tox"},
+ env={"TOX_TESTENV_PASSENV": "http_proxy https_proxy"},
stdout=ANY,
stderr=ANY,
),
@@ -152,14 +152,14 @@ class TestPlugins(CommandBaseTestCase):
"apache2",
],
cwd=PosixPath("/root/project"),
- env={"PLUGIN": "tox"},
+ env={"TOX_TESTENV_PASSENV": "http_proxy https_proxy"},
stdout=ANY,
stderr=ANY,
),
call(
["bash", "--noprofile", "--norc", "-ec", "ls"],
cwd=PosixPath("/root/project"),
- env={"PLUGIN": "tox"},
+ env={"TOX_TESTENV_PASSENV": "http_proxy https_proxy"},
stdout=ANY,
stderr=ANY,
),
diff --git a/lpcraft/plugins/plugins.py b/lpcraft/plugins/plugins.py
index 7708e35..880816e 100644
--- a/lpcraft/plugins/plugins.py
+++ b/lpcraft/plugins/plugins.py
@@ -34,10 +34,10 @@ class ToxPlugin:
@hookimpl # type: ignore
def lpcraft_set_environment(self) -> dict[str, str | None]:
- # XXX jugmac00 2021-12-17: this was added to raise coverage and is not
- # necessary. Let's remove this once we have a plugin which actually
- # needs to set environment variables.
- return {"PLUGIN": "tox"}
+ # Work around https://github.com/tox-dev/tox/issues/2372: without
+ # this, tox won't pass through the lower-case proxy environment
+ # variables set by launchpad-buildd.
+ return {"TOX_TESTENV_PASSENV": "http_proxy https_proxy"}
@register(name="pyproject-build")