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()
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)
try:
cwd = os.getcwd()
test_support.run_unittest(BaseHTTPServerTestCase,
- SimpleHTTPServerTestCase,
- CGIHTTPServerTestCase
- )
+ SimpleHTTPServerTestCase,
+ CGIHTTPServerTestCase
+ )
finally:
os.chdir(cwd)