Unset the http_proxy environment variable before running tests. Two connection tests (test_constructor and test_connection_to_unusual_port) assume that there is no external real proxy in the test environment. Turns out LibcloudConnection() will honor a http_proxy shell variable if it's set, so if the test suite is run in such an environment, these tests will fail.
Signed-off-by: Quentin Pradet <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b9d30c21 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b9d30c21 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b9d30c21 Branch: refs/heads/trunk Commit: b9d30c2163cebf1bcf83ffa871f50cced6e73342 Parents: 4838f23 Author: Andreas Hasenack <[email protected]> Authored: Mon Aug 27 20:17:19 2018 -0300 Committer: Quentin Pradet <[email protected]> Committed: Tue Aug 28 11:39:35 2018 +0400 ---------------------------------------------------------------------- libcloud/test/test_connection.py | 8 ++++++++ 1 file changed, 8 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/b9d30c21/libcloud/test/test_connection.py ---------------------------------------------------------------------- diff --git a/libcloud/test/test_connection.py b/libcloud/test/test_connection.py index 147f5b4..a916947 100644 --- a/libcloud/test/test_connection.py +++ b/libcloud/test/test_connection.py @@ -32,6 +32,14 @@ from libcloud.utils.misc import retry class BaseConnectionClassTestCase(unittest.TestCase): + + def setUp(self): + self.orig_proxy = os.environ.pop('http_proxy', None) + + def tearDown(self): + if self.orig_proxy: + os.environ['http_proxy'] = self.orig_proxy + def test_parse_proxy_url(self): conn = LibcloudBaseConnection()
