summaryrefslogtreecommitdiffstats
path: root/Lib/test/support.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-05-23 22:24:19 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-05-23 22:24:19 (GMT)
commitfea0f4d51717fb4b89154e97cfc0084a4965a688 (patch)
tree5c5234bd9ef25cc2f74445aa9a98b4134e85baf7 /Lib/test/support.py
parent25000d4d31dfa5842776aa92f234ea6672489c67 (diff)
downloadcpython-fea0f4d51717fb4b89154e97cfc0084a4965a688.zip
cpython-fea0f4d51717fb4b89154e97cfc0084a4965a688.tar.gz
cpython-fea0f4d51717fb4b89154e97cfc0084a4965a688.tar.bz2
Issue #12158: Move linux_version() from test_socket to test.support
Diffstat (limited to 'Lib/test/support.py')
-rw-r--r--Lib/test/support.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py
index 3f60d55..b03069c 100644
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -291,6 +291,14 @@ def requires(resource, msg=None):
msg = "Use of the `%s' resource not enabled" % resource
raise ResourceDenied(msg)
+def linux_version():
+ try:
+ # platform.release() is something like '2.6.33.7-desktop-2mnb'
+ version_string = platform.release().split('-')[0]
+ return tuple(map(int, version_string.split('.')))
+ except ValueError:
+ return 0, 0, 0
+
HOST = 'localhost'
def find_unused_port(family=socket.AF_INET, socktype=socket.SOCK_STREAM):