From: David Reiss Date: Sat, 31 Jan 2009 21:39:08 +0000 (+0000) Subject: python: Make the unit tests run faster and more reliably X-Git-Tag: 0.2.0~349 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=3166141fbd2152ae7281de95745089dcc4759d7d;p=common%2Fthrift.git python: Make the unit tests run faster and more reliably - The async test was making the server sleep for 2 seconds. Cut it to 0.5. - The test driver was waiting 5 seconds for shutdown. Cut it to 1. - Add a 0.25 second sleep to make sure the server comes up before the client. This is all a bit hacky, but it is better than the status quo. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@739628 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/test/py/RunClientServer.py b/test/py/RunClientServer.py index 48eadb66..b4fd3826 100755 --- a/test/py/RunClientServer.py +++ b/test/py/RunClientServer.py @@ -14,6 +14,7 @@ FRAMED = ["TNonblockingServer"] def runTest(server_class): print "Testing ", server_class serverproc = subprocess.Popen([sys.executable, relfile("TestServer.py"), server_class]) + time.sleep(0.25) try: argv = [sys.executable, relfile("TestClient.py")] if server_class in FRAMED: @@ -26,7 +27,7 @@ def runTest(server_class): os.kill(serverproc.pid, signal.SIGKILL) # wait for shutdown - time.sleep(5) + time.sleep(1) map(runTest, ["TForkingServer", "TThreadPoolServer", "TThreadedServer", "TSimpleServer", "TNonblockingServer"]) diff --git a/test/py/TestClient.py b/test/py/TestClient.py index 78dc80a1..501d197d 100755 --- a/test/py/TestClient.py +++ b/test/py/TestClient.py @@ -99,7 +99,7 @@ class AbstractTest(unittest.TestCase): def testAsync(self): start = time.time() - self.client.testAsync(2) + self.client.testAsync(0.5) end = time.time() self.assertTrue(end - start < 0.2, "async sleep took %f sec" % (end - start))