summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-06-13 00:04:19 (GMT)
committerBrett Cannon <brett@python.org>2013-06-13 00:04:19 (GMT)
commit603dcf27140ca109d11496eb4a57fe6440ddc915 (patch)
tree78b5d6fb7481df7fe941222ffb662c87fde6731c /Lib
parentd5b4e1d891e8ed8c28833d32faff3519cd403b94 (diff)
downloadcpython-603dcf27140ca109d11496eb4a57fe6440ddc915.zip
cpython-603dcf27140ca109d11496eb4a57fe6440ddc915.tar.gz
cpython-603dcf27140ca109d11496eb4a57fe6440ddc915.tar.bz2
Spruce up test_xmlrpc by using ModuleNotFoundError and moving to
unittest.main().
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_xmlrpc.py29
1 files changed, 7 insertions, 22 deletions
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
index 817cbd8..4705a0d 100644
--- a/Lib/test/test_xmlrpc.py
+++ b/Lib/test/test_xmlrpc.py
@@ -14,8 +14,12 @@ import contextlib
from test import support
try:
+ import gzip
+except ModuleNotFoundError:
+ gzip = None
+try:
import threading
-except ImportError:
+except ModuleNotFoundError:
threading = None
alist = [{'astring': 'foo@bar.baz.spam',
@@ -785,6 +789,7 @@ class KeepaliveServerTestCase2(BaseKeepaliveServerTestCase):
#A test case that verifies that gzip encoding works in both directions
#(for a request and the response)
+@unittest.skipIf(gzip is None, 'requires gzip')
class GzipServerTestCase(BaseServerTestCase):
#a request handler that supports keep-alive and logs requests into a
#class variable
@@ -1074,25 +1079,5 @@ class UseBuiltinTypesTestCase(unittest.TestCase):
self.assertTrue(server.use_builtin_types)
-@support.reap_threads
-def test_main():
- xmlrpc_tests = [XMLRPCTestCase, HelperTestCase, DateTimeTestCase,
- BinaryTestCase, FaultTestCase]
- xmlrpc_tests.append(UseBuiltinTypesTestCase)
- xmlrpc_tests.append(SimpleServerTestCase)
- xmlrpc_tests.append(KeepaliveServerTestCase1)
- xmlrpc_tests.append(KeepaliveServerTestCase2)
- try:
- import gzip
- xmlrpc_tests.append(GzipServerTestCase)
- except ImportError:
- pass #gzip not supported in this build
- xmlrpc_tests.append(MultiPathServerTestCase)
- xmlrpc_tests.append(ServerProxyTestCase)
- xmlrpc_tests.append(FailingServerTestCase)
- xmlrpc_tests.append(CGIHandlerTestCase)
-
- support.run_unittest(*xmlrpc_tests)
-
if __name__ == "__main__":
- test_main()
+ support.reap_threads(unittest.main)()