diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index de105ba6f56..b4540a4a35d 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -207,16 +207,16 @@ class GeneralModuleTests(unittest.TestCase): except AttributeError: pass -## def testHostnameRes(self): -## """Testing hostname resolution mechanisms.""" -## hostname = socket.gethostname() -## ip = socket.gethostbyname(hostname) -## self.assert_(ip.find('.') >= 0, "Error resolving host to ip.") -## hname, aliases, ipaddrs = socket.gethostbyaddr(ip) -## all_host_names = [hname] + aliases -## fqhn = socket.getfqdn() -## if not fqhn in all_host_names: -## self.fail("Error testing host resolution mechanisms.") + def testHostnameRes(self): + """Testing hostname resolution mechanisms.""" + hostname = socket.gethostname() + ip = socket.gethostbyname(hostname) + self.assert_(ip.find('.') >= 0, "Error resolving host to ip.") + hname, aliases, ipaddrs = socket.gethostbyaddr(ip) + all_host_names = [hname] + aliases + fqhn = socket.getfqdn() + if not fqhn in all_host_names: + self.fail("Error testing host resolution mechanisms.") def testRefCountGetNameInfo(self): """Testing reference count for getnameinfo.""" @@ -498,7 +498,7 @@ class FileObjectClassTestCase(SocketConnectedTest): self.cli_file.write(MSG) self.cli_file.flush() -def test_main(): +def main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(GeneralModuleTests)) suite.addTest(unittest.makeSuite(BasicTCPTest)) @@ -508,4 +508,4 @@ def test_main(): test_support.run_suite(suite) if __name__ == "__main__": - test_main() + main() diff --git a/Lib/test/test_timeout.py b/Lib/test/test_timeout.py index 7c7222290a1..d79c4ee7d9b 100644 --- a/Lib/test/test_timeout.py +++ b/Lib/test/test_timeout.py @@ -175,11 +175,11 @@ class TimeoutTestCase(unittest.TestCase): pass -def test_main(): +def main(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(CreationTestCase)) suite.addTest(unittest.makeSuite(TimeoutTestCase)) test_support.run_suite(suite) if __name__ == "__main__": - test_main() + main()