From 4f56c6c79bd29dbd2e139533179b2039d7054aa4 Mon Sep 17 00:00:00 2001 From: nyov Date: Sat, 11 Jul 2015 11:27:33 +0000 Subject: [PATCH] Unset environment proxies for tests because urllib doesn't handle $no_proxy correctly and the unittest webserver is always local. --- tests/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/__init__.py b/tests/__init__.py index c6dd45181..d017afad4 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -6,6 +6,13 @@ see http://doc.scrapy.org/en/latest/contributing.html#running-tests import os +# ignore system-wide proxies for tests +# which would send requests to a totally unsuspecting server +# (e.g. because urllib does not fully understand the proxy spec) +os.environ['http_proxy'] = '' +os.environ['https_proxy'] = '' +os.environ['ftp_proxy'] = '' + try: import unittest.mock as mock except ImportError: