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
2de51ff4
Commit
2de51ff4
authored
Feb 26, 2011
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sendfile tests more robust
parent
399fc146
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
Lib/test/test_os.py
Lib/test/test_os.py
+6
-1
No files found.
Lib/test/test_os.py
View file @
2de51ff4
...
...
@@ -1340,7 +1340,7 @@ class SendfileTestServer(asyncore.dispatcher, threading.Thread):
def
wait
(
self
):
# wait for handler connection to be closed, then stop the server
while
not
getattr
(
self
.
handler_instance
,
"closed"
,
Tru
e
):
while
not
getattr
(
self
.
handler_instance
,
"closed"
,
Fals
e
):
time
.
sleep
(
0.001
)
self
.
stop
()
...
...
@@ -1442,9 +1442,11 @@ class TestSendfile(unittest.TestCase):
self
.
assertEqual
(
offset
,
total_sent
)
self
.
assertEqual
(
total_sent
,
len
(
self
.
DATA
))
self
.
client
.
shutdown
(
socket
.
SHUT_RDWR
)
self
.
client
.
close
()
self
.
server
.
wait
()
data
=
self
.
server
.
handler_instance
.
get_data
()
self
.
assertEqual
(
len
(
data
),
len
(
self
.
DATA
))
self
.
assertEqual
(
data
,
self
.
DATA
)
def
test_send_at_certain_offset
(
self
):
...
...
@@ -1461,11 +1463,13 @@ class TestSendfile(unittest.TestCase):
total_sent
+=
sent
self
.
assertTrue
(
sent
<=
nbytes
)
self
.
client
.
shutdown
(
socket
.
SHUT_RDWR
)
self
.
client
.
close
()
self
.
server
.
wait
()
data
=
self
.
server
.
handler_instance
.
get_data
()
expected
=
self
.
DATA
[
len
(
self
.
DATA
)
//
2
:]
self
.
assertEqual
(
total_sent
,
len
(
expected
))
self
.
assertEqual
(
len
(
data
),
len
(
expected
))
self
.
assertEqual
(
data
,
expected
)
def
test_offset_overflow
(
self
):
...
...
@@ -1479,6 +1483,7 @@ class TestSendfile(unittest.TestCase):
raise
else
:
self
.
assertEqual
(
sent
,
0
)
self
.
client
.
shutdown
(
socket
.
SHUT_RDWR
)
self
.
client
.
close
()
self
.
server
.
wait
()
data
=
self
.
server
.
handler_instance
.
get_data
()
...
...
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