]> granicus.if.org Git - python/commitdiff
Move restoration of the os.environ object into the context manager where it belongs
authorNick Coghlan <ncoghlan@gmail.com>
Sat, 17 Oct 2009 15:45:52 +0000 (15:45 +0000)
committerNick Coghlan <ncoghlan@gmail.com>
Sat, 17 Oct 2009 15:45:52 +0000 (15:45 +0000)
Lib/test/test_httpservers.py
Lib/test/test_support.py

index 73354e39543f4fb7b39659e7da66fab4c45093ff..3ec014018bc3ecb3a06082b6a0957baf194a6f0e 100644 (file)
@@ -60,7 +60,6 @@ class BaseTestCase(unittest.TestCase):
         self.lock.release()
         self.thread.stop()
         os.environ.__exit__()
-        os.environ = os.environ._environ
 
     def request(self, uri, method='GET', body=None, headers={}):
         self.connection = httplib.HTTPConnection('localhost', self.PORT)
index 2f3a3784b3a0de4b3325cfdaaf4473d47de06e66..048c527db943731d523288f494166d9016d20a83 100644 (file)
@@ -576,6 +576,7 @@ class EnvironmentVarGuard(UserDict.DictMixin):
                     del self._environ[k]
             else:
                 self._environ[k] = v
+        os.environ = self._environ
 
 
 class DirsOnSysPath(object):