diff options
Diffstat (limited to 'debian/patches/isolate-from-proxy.patch')
-rw-r--r-- | debian/patches/isolate-from-proxy.patch | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/debian/patches/isolate-from-proxy.patch b/debian/patches/isolate-from-proxy.patch new file mode 100644 index 0000000..3a4c18c --- /dev/null +++ b/debian/patches/isolate-from-proxy.patch @@ -0,0 +1,67 @@ +From 920e53a9172a6a76d6f1abcef56be2edf4301596 Mon Sep 17 00:00:00 2001 +From: Colin Watson <cjwatson@debian.org> +Date: Mon, 6 Nov 2017 10:27:10 +0000 +Subject: Isolate client tests from any HTTP proxy + +Debian's Python packaging tools set http_proxy to a non-existent proxy +to help flush out packages that try to talk to the network during build, +but these tests could previously fail in more normal development +environments too. + +Forwarded: https://github.com/go-macaroon-bakery/py-macaroon-bakery/pull/28 +Last-Update: 2018-02-05 + +Patch-Name: isolate-from-proxy.patch +--- + macaroonbakery/tests/test_bakery.py | 6 ++++++ + macaroonbakery/tests/test_client.py | 7 +++++++ + 2 files changed, 13 insertions(+) + +diff --git a/macaroonbakery/tests/test_bakery.py b/macaroonbakery/tests/test_bakery.py +index a6c3e58..72a6928 100644 +--- a/macaroonbakery/tests/test_bakery.py ++++ b/macaroonbakery/tests/test_bakery.py +@@ -1,5 +1,6 @@ + # Copyright 2017 Canonical Ltd. + # Licensed under the LGPLv3, see LICENCE file for details. ++import os + from unittest import TestCase + + import macaroonbakery.httpbakery as httpbakery +@@ -171,6 +172,11 @@ def wait_on_error(url, request): + + + class TestBakery(TestCase): ++ def setUp(self): ++ super(TestBakery, self).setUp() ++ # http_proxy would cause requests to talk to the proxy, which is ++ # unlikely to know how to talk to the test server. ++ os.environ.pop('http_proxy', None) + + def assert_cookie_security(self, cookies, name, secure): + for cookie in cookies: +diff --git a/macaroonbakery/tests/test_client.py b/macaroonbakery/tests/test_client.py +index bfc7807..baafeed 100644 +--- a/macaroonbakery/tests/test_client.py ++++ b/macaroonbakery/tests/test_client.py +@@ -3,6 +3,7 @@ + import base64 + import datetime + import json ++import os + import threading + from unittest import TestCase + +@@ -27,6 +28,12 @@ TEST_OP = bakery.Op(entity='test', action='test') + + + class TestClient(TestCase): ++ def setUp(self): ++ super(TestClient, self).setUp() ++ # http_proxy would cause requests to talk to the proxy, which is ++ # unlikely to know how to talk to the test server. ++ os.environ.pop('http_proxy', None) ++ + def test_single_service_first_party(self): + b = new_bakery('loc', None, None) + |