Home | History | Annotate | Download | only in test
      1 import collections.abc
      2 import unittest
      3 from test import support
      4 
      5 import xmlrpc.client as xmlrpclib
      6 
      7 class PythonBuildersTest(unittest.TestCase):
      8 
      9     def test_python_builders(self):
     10         # Get the list of builders from the XMLRPC buildbot interface at
     11         # python.org.
     12         server = xmlrpclib.ServerProxy("http://buildbot.python.org/all/xmlrpc/")
     13         try:
     14             builders = server.getAllBuilders()
     15         except OSError as e:
     16             self.skipTest("network error: %s" % e)
     17         self.addCleanup(lambda: server('close')())
     18 
     19         # Perform a minimal sanity check on the result, just to be sure
     20         # the request means what we think it means.
     21         self.assertIsInstance(builders, collections.abc.Sequence)
     22         self.assertTrue([x for x in builders if "3.x" in x], builders)
     23 
     24 
     25 def test_main():
     26     support.requires("network")
     27     support.run_unittest(PythonBuildersTest)
     28 
     29 if __name__ == "__main__":
     30     test_main()
     31