summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2009-07-11 21:57:16 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2009-07-11 21:57:16 (GMT)
commit1bbb19aad2a94e2abf62064c5f0ad618e2b5c43d (patch)
tree91ab9767fdb4cc6eca0d5df1150fbe0fd93cf1f2
parent76430242e7a19e20c901e9e8040ef5d4e2d28c92 (diff)
downloadcpython-1bbb19aad2a94e2abf62064c5f0ad618e2b5c43d.zip
cpython-1bbb19aad2a94e2abf62064c5f0ad618e2b5c43d.tar.gz
cpython-1bbb19aad2a94e2abf62064c5f0ad618e2b5c43d.tar.bz2
merging revision 73932 from trunk:
http://bugs.python.org/issue6460 Need to be careful with thread switching when testing the xmlrpc server. The server thread may not have updated stats when the client thread tests them.
-rw-r--r--Lib/test/test_xmlrpc.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
index 100a93c..8461628 100644
--- a/Lib/test/test_xmlrpc.py
+++ b/Lib/test/test_xmlrpc.py
@@ -507,11 +507,17 @@ class KeepaliveServerTestCase(BaseServerTestCase):
def test_two(self):
p = xmlrpclib.ServerProxy(URL)
+ #do three requests.
self.assertEqual(p.pow(6,8), 6**8)
self.assertEqual(p.pow(6,8), 6**8)
+ self.assertEqual(p.pow(6,8), 6**8)
+
+ #they should have all been handled by a single request handler
self.assertEqual(len(self.RequestHandler.myRequests), 1)
- #we may or may not catch the final "append" with the empty line
- self.assertTrue(len(self.RequestHandler.myRequests[-1]) >= 2)
+
+ #check that we did at least two (the third may be pending append
+ #due to thread scheduling)
+ self.assertGreaterEqual(len(self.RequestHandler.myRequests[-1]), 2)
#A test case that verifies that gzip encoding works in both directions
#(for a request and the response)