Implement testAsync for python tests


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665485 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/py/TestClient.py b/test/py/TestClient.py
index ab2cba8..d7b65b7 100755
--- a/test/py/TestClient.py
+++ b/test/py/TestClient.py
@@ -86,6 +86,13 @@
       self.assertEqual(x.errorCode, 1001)
       self.assertEqual(x.message, 'Xception')
 
+  def testAsync(self):
+    start = time.time()
+    self.client.testAsync(2)
+    end = time.time()
+    self.assertTrue(end - start < 0.2,
+                    "async sleep took %f sec" % (end - start))
+
 class NormalBinaryTest(AbstractTest):
   protocol_factory = TBinaryProtocol.TBinaryProtocolFactory()
 
diff --git a/test/py/TestServer.py b/test/py/TestServer.py
index 94a81c0..4c6cb8a 100755
--- a/test/py/TestServer.py
+++ b/test/py/TestServer.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-import sys, glob
+import sys, glob, time
 sys.path.insert(0, './gen-py')
 sys.path.insert(0, glob.glob('../../lib/py/build/lib.*')[0])
 
@@ -52,6 +52,11 @@
       x.message = str
       raise x
 
+  def testAsync(self, seconds):
+    print 'testAsync(%d) => sleeping...' % seconds
+    time.sleep(seconds)
+    print 'done sleeping'
+
 handler = TestHandler()
 processor = ThriftTest.Processor(handler)
 transport = TSocket.TServerSocket(9090)