diff Lib/test/test_httpservers.py @ 56564:81433a676a8b legacy-trunk

Revert changes made to environment in test_httpservers
author Nick Coghlan <ncoghlan@gmail.com>
date Sat, 17 Oct 2009 15:23:08 +0000
parents 6768b2350c57
children b818a7a70a47
line wrap: on
line diff
--- a/Lib/test/test_httpservers.py	Sat Oct 17 15:09:41 2009 +0000
+++ b/Lib/test/test_httpservers.py	Sat Oct 17 15:23:08 2009 +0000
@@ -50,6 +50,7 @@
 
 class BaseTestCase(unittest.TestCase):
     def setUp(self):
+        os.environ = test_support.EnvironmentVarGuard()
         self.lock = threading.Lock()
         self.thread = TestServerThread(self, self.request_handler)
         self.thread.start()
@@ -58,6 +59,8 @@
     def tearDown(self):
         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)
@@ -390,9 +393,9 @@
     try:
         cwd = os.getcwd()
         test_support.run_unittest(BaseHTTPServerTestCase,
-                                  SimpleHTTPServerTestCase,
-                                  CGIHTTPServerTestCase
-                                  )
+                                SimpleHTTPServerTestCase,
+                                CGIHTTPServerTestCase
+                                )
     finally:
         os.chdir(cwd)