[Python-checkins] r73932 - python/trunk/Lib/test/test_xmlrpc.py
kristjan.jonsson
python-checkins at python.org
Sat Jul 11 10:44:48 CEST 2009
Author: kristjan.jonsson
Date: Sat Jul 11 10:44:43 2009
New Revision: 73932
Log:
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.
Modified:
python/trunk/Lib/test/test_xmlrpc.py
Modified: python/trunk/Lib/test/test_xmlrpc.py
==============================================================================
--- python/trunk/Lib/test/test_xmlrpc.py (original)
+++ python/trunk/Lib/test/test_xmlrpc.py Sat Jul 11 10:44:43 2009
@@ -541,11 +541,17 @@
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)
More information about the Python-checkins
mailing list