Raymond Hettinger | 57d1a88 | 2011-02-23 00:46:28 +0000 | [diff] [blame] | 1 | import collections.abc |
Neal Norwitz | 64018ae | 2008-03-24 05:51:45 +0000 | [diff] [blame] | 2 | import errno |
| 3 | import socket |
| 4 | import sys |
Jeremy Hylton | 5d8a88a | 2007-08-14 16:47:39 +0000 | [diff] [blame] | 5 | import unittest |
Benjamin Peterson | ee8712c | 2008-05-20 21:35:26 +0000 | [diff] [blame] | 6 | from test import support |
Jeremy Hylton | 5d8a88a | 2007-08-14 16:47:39 +0000 | [diff] [blame] | 7 | |
Georg Brandl | 2442015 | 2008-05-26 16:32:26 +0000 | [diff] [blame] | 8 | import xmlrpc.client as xmlrpclib |
Jeremy Hylton | 5d8a88a | 2007-08-14 16:47:39 +0000 | [diff] [blame] | 9 | |
R David Murray | aaf17b3 | 2013-10-11 12:09:51 -0400 | [diff] [blame] | 10 | class PythonBuildersTest(unittest.TestCase): |
Jeremy Hylton | 5d8a88a | 2007-08-14 16:47:39 +0000 | [diff] [blame] | 11 | |
Antoine Pitrou | 305c6b8 | 2009-11-03 17:13:59 +0000 | [diff] [blame] | 12 | def test_python_builders(self): |
| 13 | # Get the list of builders from the XMLRPC buildbot interface at |
| 14 | # python.org. |
Georg Brandl | 26af3b2 | 2012-06-24 20:06:54 +0200 | [diff] [blame] | 15 | server = xmlrpclib.ServerProxy("http://buildbot.python.org/all/xmlrpc/") |
Antoine Pitrou | 305c6b8 | 2009-11-03 17:13:59 +0000 | [diff] [blame] | 16 | try: |
| 17 | builders = server.getAllBuilders() |
Andrew Svetlov | 0832af6 | 2012-12-18 23:10:48 +0200 | [diff] [blame] | 18 | except OSError as e: |
Antoine Pitrou | 305c6b8 | 2009-11-03 17:13:59 +0000 | [diff] [blame] | 19 | self.skipTest("network error: %s" % e) |
Antoine Pitrou | f1c141b | 2011-11-28 21:14:46 +0100 | [diff] [blame] | 20 | self.addCleanup(lambda: server('close')()) |
Antoine Pitrou | 305c6b8 | 2009-11-03 17:13:59 +0000 | [diff] [blame] | 21 | |
| 22 | # Perform a minimal sanity check on the result, just to be sure |
| 23 | # the request means what we think it means. |
Raymond Hettinger | 57d1a88 | 2011-02-23 00:46:28 +0000 | [diff] [blame] | 24 | self.assertIsInstance(builders, collections.abc.Sequence) |
Brett Cannon | c84dc9d | 2010-07-05 22:11:16 +0000 | [diff] [blame] | 25 | self.assertTrue([x for x in builders if "3.x" in x], builders) |
Antoine Pitrou | 305c6b8 | 2009-11-03 17:13:59 +0000 | [diff] [blame] | 26 | |
Jeremy Hylton | 5d8a88a | 2007-08-14 16:47:39 +0000 | [diff] [blame] | 27 | |
| 28 | def test_main(): |
Benjamin Peterson | ee8712c | 2008-05-20 21:35:26 +0000 | [diff] [blame] | 29 | support.requires("network") |
R David Murray | aaf17b3 | 2013-10-11 12:09:51 -0400 | [diff] [blame] | 30 | support.run_unittest(PythonBuildersTest) |
Jeremy Hylton | 5d8a88a | 2007-08-14 16:47:39 +0000 | [diff] [blame] | 31 | |
| 32 | if __name__ == "__main__": |
| 33 | test_main() |