summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-08-20 22:39:18 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-08-20 22:39:18 (GMT)
commite67474725b5b13b48ba0007e89314214a6bdca0b (patch)
tree3279b32d93e5c8a8e56e243b3377c5be0e784a98 /Lib/test/test_socket.py
parenta9931888edcac8bbaaee813fd8b9cfa02dcb1f4f (diff)
downloadcpython-e67474725b5b13b48ba0007e89314214a6bdca0b.zip
cpython-e67474725b5b13b48ba0007e89314214a6bdca0b.tar.gz
cpython-e67474725b5b13b48ba0007e89314214a6bdca0b.tar.bz2
Issue #12326: refactor usage of sys.platform
* Use str.startswith(tuple): I didn't know this Python feature, Python rocks! * Replace sometimes sys.platform.startswith('linux') with sys.platform == 'linux' * sys.platform doesn't contain the major version on Cygwin on Mac OS X (it's just 'cygwin' and 'darwin')
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r--Lib/test/test_socket.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 320f373..4e5085e 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -442,10 +442,8 @@ class GeneralModuleTests(unittest.TestCase):
# Find one service that exists, then check all the related interfaces.
# I've ordered this by protocols that have both a tcp and udp
# protocol, at least for modern Linuxes.
- if (sys.platform.startswith('linux') or
- sys.platform.startswith('freebsd') or
- sys.platform.startswith('netbsd') or
- sys.platform == 'darwin'):
+ if (sys.platform.startswith(('freebsd', 'netbsd'))
+ or sys.platform in ('linux', 'darwin')):
# avoid the 'echo' service on this platform, as there is an
# assumption breaking non-standard port/protocol entry
services = ('daytime', 'qotd', 'domain')
@@ -2074,7 +2072,7 @@ def test_main():
])
if hasattr(socket, "socketpair"):
tests.append(BasicSocketPairTest)
- if sys.platform.startswith('linux'):
+ if sys.platform == 'linux':
tests.append(TestLinuxAbstractNamespace)
if isTipcAvailable():
tests.append(TIPCTest)