mirror of
https://github.com/python/cpython.git
synced 2025-07-23 19:25:40 +00:00

Instead of explicitly enumerate test classes for run_unittest()
use the unittest ability to discover tests. This also makes these
tests discoverable and runnable with unittest.
load_tests() can be used for dynamic generating tests and adding
doctests. setUpModule(), tearDownModule() and addModuleCleanup()
can be used for running code before and after all module tests.
(cherry picked from commit 40348acc18
)
31 lines
954 B
Python
31 lines
954 B
Python
import collections.abc
|
|
import unittest
|
|
from test import support
|
|
|
|
import xmlrpc.client as xmlrpclib
|
|
|
|
|
|
support.requires("network")
|
|
|
|
|
|
@unittest.skip('XXX: buildbot.python.org/all/xmlrpc/ is gone')
|
|
class PythonBuildersTest(unittest.TestCase):
|
|
|
|
def test_python_builders(self):
|
|
# Get the list of builders from the XMLRPC buildbot interface at
|
|
# python.org.
|
|
server = xmlrpclib.ServerProxy("http://buildbot.python.org/all/xmlrpc/")
|
|
try:
|
|
builders = server.getAllBuilders()
|
|
except OSError as e:
|
|
self.skipTest("network error: %s" % e)
|
|
self.addCleanup(lambda: server('close')())
|
|
|
|
# Perform a minimal sanity check on the result, just to be sure
|
|
# the request means what we think it means.
|
|
self.assertIsInstance(builders, collections.abc.Sequence)
|
|
self.assertTrue([x for x in builders if "3.x" in x], builders)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|