[Python-modules-commits] [py-macaroon-bakery] 02/04: Isolate client tests from any HTTP proxy

Colin Watson cjwatson at moszumanska.debian.org
Sat Nov 11 13:31:49 UTC 2017


This is an automated email from the git hooks/post-receive script.

cjwatson pushed a commit to branch master
in repository py-macaroon-bakery.

commit 530e1e702c8743fc8ea93db035bf86f6c07e6d09
Author: Colin Watson <cjwatson at debian.org>
Date:   Mon Nov 6 10:27:10 2017 +0000

    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: 2017-11-06
    
    Patch-Name: isolate-from-proxy.patch
---
 macaroonbakery/tests/test_client.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/macaroonbakery/tests/test_client.py b/macaroonbakery/tests/test_client.py
index e1a4009..8263f54 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
 from unittest import TestCase
 try:
     from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
@@ -26,6 +27,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)
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/py-macaroon-bakery.git



More information about the Python-modules-commits mailing list