Skip to content

Commit

Permalink
tox plugin: Pass through lower-case proxy environment variables
Browse files Browse the repository at this point in the history
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
(tox-dev/tox#2372), but work around it for
now.
  • Loading branch information
cjwatson committed Apr 8, 2022
1 parent 043c932 commit f46a8dc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
====================
Expand Down
8 changes: 4 additions & 4 deletions lpcraft/plugin/tests/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_tox_plugin(self, mock_get_host_architecture, mock_get_provider):
"apache2",
],
cwd=PosixPath("/root/project"),
env={"PLUGIN": "tox"},
env={"TOX_TESTENV_PASSENV": "http_proxy https_proxy"},
stdout=ANY,
stderr=ANY,
),
Expand All @@ -73,7 +73,7 @@ def test_tox_plugin(self, mock_get_host_architecture, mock_get_provider):
"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,
),
Expand Down Expand Up @@ -152,14 +152,14 @@ def test_run_command_from_configuration_takes_precedence(
"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,
),
Expand Down
8 changes: 4 additions & 4 deletions lpcraft/plugins/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ def lpcraft_execute_run(self) -> str:

@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")
Expand Down

0 comments on commit f46a8dc

Please sign in to comment.