Revert changes made to environment in test_httpservers

This commit is contained in:
Nick Coghlan 2009-10-17 15:23:08 +00:00
parent 8c1ffeb614
commit 87c03b3108
1 changed files with 6 additions and 3 deletions

View File

@ -50,6 +50,7 @@ class TestServerThread(threading.Thread):
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 @@ class BaseTestCase(unittest.TestCase):
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)