diff options
author | R. David Murray <rdmurray@bitdance.com> | 2010-02-24 01:46:21 (GMT) |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2010-02-24 01:46:21 (GMT) |
commit | 378c0cf5abb4c49c1a95597d3c5284dc93dd7822 (patch) | |
tree | 0a7c9a724887dff98a5abefd9b09da0de6889731 /Lib/test/test_xmlrpc.py | |
parent | 72aee3dcabf98a0b8a7a60cccab4fbd1ef63fbd2 (diff) | |
download | cpython-378c0cf5abb4c49c1a95597d3c5284dc93dd7822.zip cpython-378c0cf5abb4c49c1a95597d3c5284dc93dd7822.tar.gz cpython-378c0cf5abb4c49c1a95597d3c5284dc93dd7822.tar.bz2 |
Merged revisions 78351 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78351 | r.david.murray | 2010-02-22 19:24:49 -0500 (Mon, 22 Feb 2010) | 5 lines
Issue 6292: for the moment at least, the test suite passes if run
with -OO. Tests requiring docstrings are skipped. Patch by
Brian Curtin, thanks to Matias Torchinsky for helping review and
improve the patch.
........
Diffstat (limited to 'Lib/test/test_xmlrpc.py')
-rw-r--r-- | Lib/test/test_xmlrpc.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index 2ae4396..3bc88eb 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -383,6 +383,22 @@ def is_unavailable_exception(e): if exc_mess and 'temporarily unavailable' in exc_mess.lower(): return True +def make_request_and_skipIf(condition, reason): + # If we skip the test, we have to make a request because the + # the server created in setUp blocks expecting one to come in. + if not condition: + return lambda func: func + def decorator(func): + def make_request_and_skip(self): + try: + xmlrpclib.ServerProxy(URL).my_function() + except (xmlrpclib.ProtocolError, socket.error) as e: + if not is_unavailable_exception(e): + raise + raise unittest.SkipTest(reason) + return make_request_and_skip + return decorator + class BaseServerTestCase(unittest.TestCase): requestHandler = None request_count = 1 @@ -403,6 +419,7 @@ class BaseServerTestCase(unittest.TestCase): def tearDown(self): # wait on the server thread to terminate self.evt.wait(4.0) + # XXX this code does not work, and in fact stop_serving doesn't exist. if not self.evt.is_set(): self.evt.set() stop_serving() @@ -474,6 +491,8 @@ class SimpleServerTestCase(BaseServerTestCase): # protocol error; provide additional information in test output self.fail("%s\n%s" % (e, getattr(e, "headers", ""))) + @make_request_and_skipIf(sys.flags.optimize >= 2, + "Docstrings are omitted with -O2 and above") def test_introspection3(self): try: # test native doc |