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
1cae8b58
Commit
1cae8b58
authored
Oct 23, 2010
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also guard other SOCK_NONBLOCK test
parent
75d8c5ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
Lib/test/test_socket.py
Lib/test/test_socket.py
+13
-9
No files found.
Lib/test/test_socket.py
View file @
1cae8b58
...
...
@@ -35,6 +35,14 @@ def try_address(host, port=0, family=socket.AF_INET):
sock
.
close
()
return
True
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
(
'utf8'
)
## test unicode string and carriage return
SUPPORTS_IPV6
=
socket
.
has_ipv6
and
try_address
(
'::1'
,
family
=
socket
.
AF_INET6
)
...
...
@@ -911,10 +919,14 @@ class NonBlockingTCPTests(ThreadedTCPSocketTest):
if
hasattr
(
socket
,
"SOCK_NONBLOCK"
):
def
testInitNonBlocking
(
self
):
v
=
linux_version
()
if
v
<
(
2
,
6
,
28
):
self
.
skipTest
(
"Linux kernel 2.6.28 or higher required, not %s"
%
"."
.
join
(
map
(
str
,
v
)))
# reinit server socket
self
.
serv
.
close
()
self
.
serv
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
|
socket
.
SOCK_NONBLOCK
)
socket
.
SOCK_NONBLOCK
)
self
.
port
=
support
.
bind_port
(
self
.
serv
)
self
.
serv
.
listen
(
1
)
# actual testing
...
...
@@ -1829,14 +1841,6 @@ class ContextManagersTest(ThreadedTCPSocketTest):
self
.
assertRaises
(
socket
.
error
,
sock
.
sendall
,
b'foo'
)
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
@
unittest
.
skipUnless
(
hasattr
(
socket
,
"SOCK_CLOEXEC"
),
"SOCK_CLOEXEC not defined"
)
@
unittest
.
skipUnless
(
fcntl
,
"module fcntl not available"
)
...
...
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