]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix test_socket's test for socket.getfqdn() to also accept the result from
authorBrett Cannon <bcannon@gmail.com>
Sat, 12 Mar 2005 06:15:56 +0000 (06:15 +0000)
committerBrett Cannon <bcannon@gmail.com>
Sat, 12 Mar 2005 06:15:56 +0000 (06:15 +0000)
socket.gethostname() as a valid return value.

Also clarified the docs as they were a little hazy on the subject matter.

Doc/lib/libsocket.tex
Lib/socket.py
Lib/test/test_socket.py
Misc/NEWS

index db0b76762f4da9d02e2876815361e040ab76cf2d..1f5bcaa6155f3629834b586721deeb7d11480e93 100644 (file)
@@ -202,8 +202,8 @@ If \var{name} is omitted or empty, it is interpreted as the local
 host.  To find the fully qualified name, the hostname returned by
 \function{gethostbyaddr()} is checked, then aliases for the host, if
 available.  The first name which includes a period is selected.  In
-case no fully qualified domain name is available, the hostname is
-returned.
+case no fully qualified domain name is available, the hostname as
+returned by \function{gethostname()} is returned.
 \versionadded{2.0}
 \end{funcdesc}
 
index f96a14683715eabfec8936cea14e6f9a63a381cb..5fd51f441d34f22a11d8107e396554b3f9b06806 100644 (file)
@@ -102,7 +102,7 @@ def getfqdn(name=''):
 
     First the hostname returned by gethostbyaddr() is checked, then
     possibly existing aliases. In case no FQDN is available, hostname
-    is returned.
+    as returned by gethostname() is returned.
     """
     name = name.strip()
     if not name or name == '0.0.0.0':
index e6cdb8b2cc2f43e26c3a2dcf5890c4335524ab20..bf2ecae507c245ba131fb3b26ca73e4a6d22388b 100644 (file)
@@ -267,7 +267,7 @@ class GeneralModuleTests(unittest.TestCase):
         except socket.error:
             # Probably a similar problem as above; skip this test
             return
-        all_host_names = [hname] + aliases
+        all_host_names = [hostname, hname] + aliases
         fqhn = socket.getfqdn()
         if not fqhn in all_host_names:
             self.fail("Error testing host resolution mechanisms.")
index 8034f0df3672602387fd3e4cf1e5ff5b334f7794..b8b8a9ce72d3d0459e07efc29087e7ac5bef3a6b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -22,6 +22,14 @@ Library
   #1110478: revert os.environ.update to do putenv again).
 
 
+Tests
+-----
+
+- Fix the test for socket.getfqdn() in test_socket to also consider the host
+  name returned by socket.gethostname() a valid return value for getfqdn().
+  Also clarified the wording of docs and docstring that this is the case.
+
+
 What's New in Python 2.4.1c1?
 =============================