[lxc-devel] [pylxd/master] Fix ValueError when HTTP_PROXY env var is present
moreati on Github
lxc-bot at linuxcontainers.org
Sun Jun 12 16:17:23 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 312 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160612/b4502e1a/attachment.bin>
-------------- next part --------------
From f0c5b03a4e73709f8f79688a473cac0f75335e2d Mon Sep 17 00:00:00 2001
From: Alex Willmer <alex at moreati.org.uk>
Date: Sun, 12 Jun 2016 17:11:40 +0100
Subject: [PATCH 1/2] Add integration test for HTTP_PROXY environment variable
The test will fail until requests-unixsockets is upgraded.
---
integration/test_proxies.py | 13 +++++++++++++
tox.ini | 6 +++++-
2 files changed, 18 insertions(+), 1 deletion(-)
create mode 100644 integration/test_proxies.py
diff --git a/integration/test_proxies.py b/integration/test_proxies.py
new file mode 100644
index 0000000..2e1393b
--- /dev/null
+++ b/integration/test_proxies.py
@@ -0,0 +1,13 @@
+import os
+import unittest
+
+from pylxd.client import Client
+
+
+class ProxyTestCase(unittest.TestCase):
+
+ @unittest.skipIf('HTTP_PROXY' not in os.environ,
+ 'requires an HTTP_PROXY environment variable')
+ def test_create_with_proxy_env_var(self):
+ client = Client()
+ self.assertEqual(200, client.api.get().status_code)
diff --git a/tox.ini b/tox.ini
index e3e3ea9..807114b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -17,7 +17,11 @@ commands = nosetests --with-coverage --cover-package=pylxd pylxd
commands = flake8 --ignore=E123,E125
[testenv:integration]
-commands = nosetests integration
+whitelist_externals =
+ env
+commands =
+ env HTTP_PROXY='http://127.0.0.42' nosetests integration.test_proxies
+ nosetests integration
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
From 99394188d19ad1881d4338d390e746bd28cac46c Mon Sep 17 00:00:00 2001
From: Alex Willmer <alex at moreati.org.uk>
Date: Sun, 12 Jun 2016 17:15:21 +0100
Subject: [PATCH 2/2] Require latest version of requests-unixsocket
requests-unixsocket 0.1.5 incorporates a fix for
ValueError: UnixAdapter does not support specifying proxies
raised when any proxy related environment variables are present.
Fixes #138
---
requirements.txt | 2 +-
setup.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index 2c17149..66e56a2 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -3,5 +3,5 @@ python-dateutil>=2.4.2
six>=1.9.0
ws4py>=0.3.4
requests!=2.8.0,>=2.5.2
-requests-unixsocket==0.1.4
+requests-unixsocket>=0.1.5
cryptography>=1.4
diff --git a/setup.py b/setup.py
index ec1eed0..84ffa3f 100644
--- a/setup.py
+++ b/setup.py
@@ -28,6 +28,6 @@
setup_requires=[
'pbr>=1.8',
'requests!=2.8.0,>=2.5.2',
- 'requests-unixsocket==0.1.4',
+ 'requests-unixsocket>=0.1.5',
],
pbr=True)
More information about the lxc-devel
mailing list