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
83432bab
Commit
83432bab
authored
Oct 29, 2010
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #7547: fix transient failures due to network glitches in test_timeout.
Patch by Sandro Tosi.
parent
3cdfb123
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
Lib/test/test_timeout.py
Lib/test/test_timeout.py
+11
-9
No files found.
Lib/test/test_timeout.py
View file @
83432bab
...
...
@@ -130,17 +130,19 @@ class TimeoutTestCase(unittest.TestCase):
def
testRecvTimeout
(
self
):
# Test recv() timeout
_timeout
=
0.02
self
.
sock
.
connect
(
self
.
addr_remote
)
self
.
sock
.
settimeout
(
_timeout
)
_t1
=
time
.
time
()
self
.
assertRaises
(
socket
.
error
,
self
.
sock
.
recv
,
1024
)
_t2
=
time
.
time
(
)
with
support
.
transient_internet
(
self
.
addr_remote
[
0
]):
self
.
sock
.
connect
(
self
.
addr_remote
)
self
.
sock
.
settimeout
(
_timeout
)
_delta
=
abs
(
_t1
-
_t2
)
self
.
assertTrue
(
_delta
<
_timeout
+
self
.
fuzz
,
"timeout (%g) is %g seconds more than expected (%g)"
%
(
_delta
,
self
.
fuzz
,
_timeout
))
_t1
=
time
.
time
()
self
.
assertRaises
(
socket
.
timeout
,
self
.
sock
.
recv
,
1024
)
_t2
=
time
.
time
()
_delta
=
abs
(
_t1
-
_t2
)
self
.
assertTrue
(
_delta
<
_timeout
+
self
.
fuzz
,
"timeout (%g) is %g seconds more than expected (%g)"
%
(
_delta
,
self
.
fuzz
,
_timeout
))
def
testAcceptTimeout
(
self
):
# Test accept() timeout
...
...
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