summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-04-25 22:19:43 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-04-25 22:19:43 (GMT)
commit08911bd33e2f81239891581da7f07f6bba2d61a6 (patch)
treed9ab61f0b82faeeb2edd962ba2ad386918925aa4 /Lib
parent3bcba8e2889708f646df50953cd45a4f2cf28b02 (diff)
downloadcpython-08911bd33e2f81239891581da7f07f6bba2d61a6.zip
cpython-08911bd33e2f81239891581da7f07f6bba2d61a6.tar.gz
cpython-08911bd33e2f81239891581da7f07f6bba2d61a6.tar.bz2
Merged revisions 80480 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r80480 | antoine.pitrou | 2010-04-25 23:15:50 +0200 (dim., 25 avril 2010) | 3 lines Replace a Lock with a better suited Event. ........
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_httpservers.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
index 71ec296..5aa4af4 100644
--- a/Lib/test/test_httpservers.py
+++ b/Lib/test/test_httpservers.py
@@ -34,14 +34,14 @@ class TestServerThread(threading.Thread):
threading.Thread.__init__(self)
self.request_handler = request_handler
self.test_object = test_object
- self.test_object.lock.acquire()
def run(self):
self.server = HTTPServer(('', 0), self.request_handler)
self.test_object.PORT = self.server.socket.getsockname()[1]
- self.test_object.lock.release()
+ self.test_object.server_started.set()
+ self.test_object = None
try:
- self.server.serve_forever()
+ self.server.serve_forever(0.05)
finally:
self.server.server_close()
@@ -53,13 +53,12 @@ class BaseTestCase(unittest.TestCase):
def setUp(self):
self._threads = support.threading_setup()
os.environ = support.EnvironmentVarGuard()
- self.lock = threading.Lock()
+ self.server_started = threading.Event()
self.thread = TestServerThread(self, self.request_handler)
self.thread.start()
- self.lock.acquire()
+ self.server_started.wait()
def tearDown(self):
- self.lock.release()
self.thread.stop()
os.environ.__exit__()
support.threading_cleanup(*self._threads)