[Python-checkins] cpython (3.3): Cleanup this test's modification of os.environ in teardown (this already

gregory.p.smith python-checkins at python.org
Mon Nov 18 22:10:52 CET 2013


http://hg.python.org/cpython/rev/615b5918b2ae
changeset:   87251:615b5918b2ae
branch:      3.3
parent:      87224:9791c5d55f52
user:        Gregory P. Smith <greg at krypto.org>
date:        Mon Nov 18 21:10:04 2013 +0000
summary:
  Cleanup this test's modification of os.environ in teardown (this already
exists in 3.4 but apparently wasn't done for 3.3).

files:
  Lib/test/test_urllib2_localnet.py |  3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py
--- a/Lib/test/test_urllib2_localnet.py
+++ b/Lib/test/test_urllib2_localnet.py
@@ -353,12 +353,15 @@
     def setUp(self):
         super(TestUrlopen, self).setUp()
         # Ignore proxies for localhost tests.
+        self.old_environ = os.environ.copy()
         os.environ['NO_PROXY'] = '*'
         self.server = None
 
     def tearDown(self):
         if self.server is not None:
             self.server.stop()
+        os.environ.clear()
+        os.environ.update(self.old_environ)
         super(TestUrlopen, self).tearDown()
 
     def urlopen(self, url, data=None, **kwargs):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list