summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-01-03 22:55:38 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-01-03 22:55:38 (GMT)
commitff96b2ae14b1efdfc01e202a03e5d464fdedfc87 (patch)
treef8c62eba965867802e6dd199bc64490b00dc2650 /Lib/test/test_urllib.py
parent3de5a08420e3f13d5ec03cbbc498c830e5c08665 (diff)
downloadcpython-ff96b2ae14b1efdfc01e202a03e5d464fdedfc87.zip
cpython-ff96b2ae14b1efdfc01e202a03e5d464fdedfc87.tar.gz
cpython-ff96b2ae14b1efdfc01e202a03e5d464fdedfc87.tar.bz2
test_urllib would set environment variable NO_PROXY without removing it afterwards.
Diffstat (limited to 'Lib/test/test_urllib.py')
-rw-r--r--Lib/test/test_urllib.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 6568732..a46f421 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -130,10 +130,14 @@ class ProxyTests(unittest.TestCase):
os.environ[k] = v
def test_getproxies_environment_keep_no_proxies(self):
- os.environ['NO_PROXY'] = 'localhost'
- proxies = urllib.request.getproxies_environment()
- # getproxies_environment use lowered case truncated (no '_proxy') keys
- self.assertEquals('localhost', proxies['no'])
+ try:
+ os.environ['NO_PROXY'] = 'localhost'
+ proxies = urllib.request.getproxies_environment()
+ # getproxies_environment use lowered case truncated (no '_proxy') keys
+ self.assertEquals('localhost', proxies['no'])
+ finally:
+ # The old value will be restored by tearDown, if applicable.
+ del os.environ['NO_PROXY']
class urlopen_HttpTests(unittest.TestCase):