[Python-checkins] cpython: Spruce up test_xmlrpc by using ModuleNotFoundError and moving to
brett.cannon
python-checkins at python.org
Thu Jun 13 02:04:28 CEST 2013
http://hg.python.org/cpython/rev/281857369a78
changeset: 84105:281857369a78
user: Brett Cannon <brett at python.org>
date: Wed Jun 12 20:04:19 2013 -0400
summary:
Spruce up test_xmlrpc by using ModuleNotFoundError and moving to
unittest.main().
files:
Lib/test/test_xmlrpc.py | 29 +++++++----------------------
1 files changed, 7 insertions(+), 22 deletions(-)
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
--- a/Lib/test/test_xmlrpc.py
+++ b/Lib/test/test_xmlrpc.py
@@ -14,8 +14,12 @@
from test import support
try:
+ import gzip
+except ModuleNotFoundError:
+ gzip = None
+try:
import threading
-except ImportError:
+except ModuleNotFoundError:
threading = None
alist = [{'astring': 'foo at bar.baz.spam',
@@ -785,6 +789,7 @@
#A test case that verifies that gzip encoding works in both directions
#(for a request and the response)
+ at 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 @@
self.assertTrue(server.use_builtin_types)
- at 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)()
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list