mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Issue #12158: Move linux_version() from test_socket to test.support
This commit is contained in:
parent
25000d4d31
commit
fea0f4d517
2 changed files with 11 additions and 11 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue