summaryrefslogtreecommitdiff
path: root/debian/patches/isolate-from-proxy.patch
blob: ee5d08a0b6922bd12ef5466caedf345883105c59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From 8051fc0e07186078ae5419ac9de246cf6e57359a 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: 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)