Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
fea0f4d5
Commit
fea0f4d5
authored
May 24, 2011
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #12158: Move linux_version() from test_socket to test.support
parent
25000d4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
Lib/test/support.py
Lib/test/support.py
+8
-0
Lib/test/test_socket.py
Lib/test/test_socket.py
+3
-11
No files found.
Lib/test/support.py
View file @
fea0f4d5
...
...
@@ -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
):
...
...
Lib/test/test_socket.py
View file @
fea0f4d5
...
...
@@ -24,14 +24,6 @@ try:
except
ImportError
:
fcntl
=
False
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
=
support
.
HOST
MSG
=
'Michael Gilfix was here
\
u1234
\
r
\
n
'
.
encode
(
'utf-8'
)
## test unicode string and carriage return
...
...
@@ -1032,7 +1024,7 @@ class NonBlockingTCPTests(ThreadedTCPSocketTest):
if
hasattr
(
socket
,
"SOCK_NONBLOCK"
):
def
testInitNonBlocking
(
self
):
v
=
linux_version
()
v
=
support
.
linux_version
()
if
v
<
(
2
,
6
,
28
):
self
.
skipTest
(
"Linux kernel 2.6.28 or higher required, not %s"
%
"."
.
join
(
map
(
str
,
v
)))
...
...
@@ -2010,7 +2002,7 @@ class ContextManagersTest(ThreadedTCPSocketTest):
@
unittest
.
skipUnless
(
fcntl
,
"module fcntl not available"
)
class
CloexecConstantTest
(
unittest
.
TestCase
):
def
test_SOCK_CLOEXEC
(
self
):
v
=
linux_version
()
v
=
support
.
linux_version
()
if
v
<
(
2
,
6
,
28
):
self
.
skipTest
(
"Linux kernel 2.6.28 or higher required, not %s"
%
"."
.
join
(
map
(
str
,
v
)))
...
...
@@ -2032,7 +2024,7 @@ class NonblockConstantTest(unittest.TestCase):
self
.
assertEqual
(
s
.
gettimeout
(),
None
)
def
test_SOCK_NONBLOCK
(
self
):
v
=
linux_version
()
v
=
support
.
linux_version
()
if
v
<
(
2
,
6
,
28
):
self
.
skipTest
(
"Linux kernel 2.6.28 or higher required, not %s"
%
"."
.
join
(
map
(
str
,
v
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment