1. Armin Rigo
  2. cpython-withatomic

Commits

Brett Cannon  committed 0c82a7e

Fix test_socket's test for socket.getfqdn() to also accept the result from
socket.gethostname() as a valid return value.

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

  • Participants
  • Parent commits 8d8ba66
  • Branches 2.4

Comments (0)

Files changed (4)

File Doc/lib/libsocket.tex

View file
  • Ignore whitespace
 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}
 

File Lib/socket.py

View file
  • Ignore whitespace
 
     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':

File Lib/test/test_socket.py

View file
  • Ignore whitespace
         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.")

File Misc/NEWS

View file
  • Ignore whitespace
   #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?
 =============================