mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
Revert changes made to environment in test_httpservers
This commit is contained in:
parent
8c1ffeb614
commit
87c03b3108
1 changed files with 6 additions and 3 deletions
|
@ -50,6 +50,7 @@ class TestServerThread(threading.Thread):
|
||||||
|
|
||||||
class BaseTestCase(unittest.TestCase):
|
class BaseTestCase(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
os.environ = test_support.EnvironmentVarGuard()
|
||||||
self.lock = threading.Lock()
|
self.lock = threading.Lock()
|
||||||
self.thread = TestServerThread(self, self.request_handler)
|
self.thread = TestServerThread(self, self.request_handler)
|
||||||
self.thread.start()
|
self.thread.start()
|
||||||
|
@ -58,6 +59,8 @@ class BaseTestCase(unittest.TestCase):
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
self.thread.stop()
|
self.thread.stop()
|
||||||
|
os.environ.__exit__()
|
||||||
|
os.environ = os.environ._environ
|
||||||
|
|
||||||
def request(self, uri, method='GET', body=None, headers={}):
|
def request(self, uri, method='GET', body=None, headers={}):
|
||||||
self.connection = httplib.HTTPConnection('localhost', self.PORT)
|
self.connection = httplib.HTTPConnection('localhost', self.PORT)
|
||||||
|
@ -390,9 +393,9 @@ def test_main(verbose=None):
|
||||||
try:
|
try:
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
test_support.run_unittest(BaseHTTPServerTestCase,
|
test_support.run_unittest(BaseHTTPServerTestCase,
|
||||||
SimpleHTTPServerTestCase,
|
SimpleHTTPServerTestCase,
|
||||||
CGIHTTPServerTestCase
|
CGIHTTPServerTestCase
|
||||||
)
|
)
|
||||||
finally:
|
finally:
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue