summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2002-08-02 15:52:30 (GMT)
committerSkip Montanaro <skip@pobox.com>2002-08-02 15:52:30 (GMT)
commitf4433303a82b8ed960930227ab06a404e1f8dbec (patch)
tree0610a82340ef9a4dc0a35dc0a52f4823af16d26f /Lib/test/test_socket.py
parent940e970f6e57bc39b77b7a45babd372803af2414 (diff)
downloadcpython-f4433303a82b8ed960930227ab06a404e1f8dbec.zip
cpython-f4433303a82b8ed960930227ab06a404e1f8dbec.tar.gz
cpython-f4433303a82b8ed960930227ab06a404e1f8dbec.tar.bz2
testGetServByName shouldn't check for getservbyname - the socket module
should always have it.
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r--Lib/test/test_socket.py35
1 files changed, 17 insertions, 18 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index b4bb293..737b431 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -259,24 +259,23 @@ class GeneralModuleTests(unittest.TestCase):
def testGetServByName(self):
"""Testing getservbyname()."""
- if hasattr(socket, 'getservbyname'):
- # try a few protocols - not everyone has telnet enabled
- found = 0
- for proto in ("telnet", "ssh", "www", "ftp"):
- try:
- socket.getservbyname(proto, 'tcp')
- found = 1
- break
- except socket.error:
- pass
- try:
- socket.getservbyname(proto, 'udp')
- found = 1
- break
- except socket.error:
- pass
- if not found:
- raise socket.error
+ # try a few protocols - not everyone has telnet enabled
+ found = 0
+ for proto in ("telnet", "ssh", "www", "ftp"):
+ try:
+ socket.getservbyname(proto, 'tcp')
+ found = 1
+ break
+ except socket.error:
+ pass
+ try:
+ socket.getservbyname(proto, 'udp')
+ found = 1
+ break
+ except socket.error:
+ pass
+ if not found:
+ raise socket.error
def testDefaultTimeout(self):
"""Testing default timeout."""