mirror of
https://github.com/python/cpython.git
synced 2025-11-18 01:57:37 +00:00
(Hopefully) suppress transient refleaks in test_httpservers.
This commit is contained in:
parent
f829d1f551
commit
85bd5879b2
1 changed files with 2 additions and 0 deletions
|
|
@ -50,6 +50,7 @@ class TestServerThread(threading.Thread):
|
||||||
|
|
||||||
class BaseTestCase(unittest.TestCase):
|
class BaseTestCase(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
self._threads = test_support.threading_setup()
|
||||||
os.environ = test_support.EnvironmentVarGuard()
|
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)
|
||||||
|
|
@ -60,6 +61,7 @@ class BaseTestCase(unittest.TestCase):
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
self.thread.stop()
|
self.thread.stop()
|
||||||
os.environ.__exit__()
|
os.environ.__exit__()
|
||||||
|
test_support.threading_cleanup(*self._threads)
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue