Kaydet (Commit) 492e5920 authored tarafından Facundo Batista's avatar Facundo Batista

Ignore test failures caused by 'resource temporarily unavailable'

exceptions raised during FailingServerTestCase tests.
[GSoC - Alan McIntyre]
üst 4a40f0ce
...@@ -483,8 +483,10 @@ class FailingServerTestCase(unittest.TestCase): ...@@ -483,8 +483,10 @@ class FailingServerTestCase(unittest.TestCase):
p = xmlrpclib.ServerProxy('http://localhost:%d' % PORT) p = xmlrpclib.ServerProxy('http://localhost:%d' % PORT)
self.assertEqual(p.pow(6,8), 6**8) self.assertEqual(p.pow(6,8), 6**8)
except xmlrpclib.ProtocolError, e: except xmlrpclib.ProtocolError, e:
# protocol error; provide additional information in test output # ignore failures due to non-blocking socket 'unavailable' errors
self.fail("%s\n%s" % (e, e.headers)) if not is_unavailable_exception(e):
# protocol error; provide additional information in test output
self.fail("%s\n%s" % (e, e.headers))
def test_fail_no_info(self): def test_fail_no_info(self):
# use the broken message class # use the broken message class
...@@ -494,9 +496,11 @@ class FailingServerTestCase(unittest.TestCase): ...@@ -494,9 +496,11 @@ class FailingServerTestCase(unittest.TestCase):
p = xmlrpclib.ServerProxy('http://localhost:%d' % PORT) p = xmlrpclib.ServerProxy('http://localhost:%d' % PORT)
p.pow(6,8) p.pow(6,8)
except xmlrpclib.ProtocolError, e: except xmlrpclib.ProtocolError, e:
# The two server-side error headers shouldn't be sent back in this case # ignore failures due to non-blocking socket 'unavailable' errors
self.assertTrue(e.headers.get("X-exception") is None) if not is_unavailable_exception(e):
self.assertTrue(e.headers.get("X-traceback") is None) # The two server-side error headers shouldn't be sent back in this case
self.assertTrue(e.headers.get("X-exception") is None)
self.assertTrue(e.headers.get("X-traceback") is None)
else: else:
self.fail('ProtocolError not raised') self.fail('ProtocolError not raised')
...@@ -512,10 +516,12 @@ class FailingServerTestCase(unittest.TestCase): ...@@ -512,10 +516,12 @@ class FailingServerTestCase(unittest.TestCase):
p = xmlrpclib.ServerProxy('http://localhost:%d' % PORT) p = xmlrpclib.ServerProxy('http://localhost:%d' % PORT)
p.pow(6,8) p.pow(6,8)
except xmlrpclib.ProtocolError, e: except xmlrpclib.ProtocolError, e:
# We should get error info in the response # ignore failures due to non-blocking socket 'unavailable' errors
expected_err = "invalid literal for int() with base 10: 'I am broken'" if not is_unavailable_exception(e):
self.assertEqual(e.headers.get("x-exception"), expected_err) # We should get error info in the response
self.assertTrue(e.headers.get("x-traceback") is not None) expected_err = "invalid literal for int() with base 10: 'I am broken'"
self.assertEqual(e.headers.get("x-exception"), expected_err)
self.assertTrue(e.headers.get("x-traceback") is not None)
else: else:
self.fail('ProtocolError not raised') self.fail('ProtocolError not raised')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment