(self)
| 1100 | self.assertHasAttr(socket, opt) |
| 1101 | |
| 1102 | def testHostnameRes(self): |
| 1103 | # Testing hostname resolution mechanisms |
| 1104 | hostname = socket.gethostname() |
| 1105 | try: |
| 1106 | ip = socket.gethostbyname(hostname) |
| 1107 | except OSError: |
| 1108 | # Probably name lookup wasn't set up right; skip this test |
| 1109 | self.skipTest('name lookup failure') |
| 1110 | self.assertTrue(ip.find('.') >= 0, "Error resolving host to ip.") |
| 1111 | try: |
| 1112 | hname, aliases, ipaddrs = socket.gethostbyaddr(ip) |
| 1113 | except OSError: |
| 1114 | # Probably a similar problem as above; skip this test |
| 1115 | self.skipTest('name lookup failure') |
| 1116 | all_host_names = [hostname, hname] + aliases |
| 1117 | fqhn = socket.getfqdn(ip) |
| 1118 | if not fqhn in all_host_names: |
| 1119 | self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqhn, repr(all_host_names))) |
| 1120 | |
| 1121 | def test_host_resolution(self): |
| 1122 | for addr in [socket_helper.HOSTv4, '10.0.0.1', '255.255.255.255']: |
nothing calls this directly
no test coverage detected