Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
72503017
Commit
72503017
authored
Sep 09, 2009
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add greentest.GenericWaitTestCase
parent
cbfda28f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
greentest/__init__.py
greentest/__init__.py
+25
-0
No files found.
greentest/__init__.py
View file @
72503017
...
...
@@ -24,6 +24,8 @@ import sys
import
os
import
errno
import
unittest
import
time
import
gevent
disabled_marker
=
'-*-*-*-*-*- disabled -*-*-*-*-*-'
...
...
@@ -92,3 +94,26 @@ class CountingHub(_original_Hub):
return
_original_Hub
.
switch
(
self
)
gevent
.
hub
.
Hub
=
CountingHub
class
GenericWaitTestCase
(
TestCase
):
def
wait
(
self
,
timeout
):
raise
NotImplementedError
(
'override me in subclass'
)
def
test_outer_timeout_is_not_lost
(
self
):
t
=
gevent
.
Timeout
.
start_new
(
0.01
)
try
:
self
.
wait
(
timeout
=
0.02
)
except
gevent
.
Timeout
,
ex
:
assert
ex
is
t
,
(
ex
,
t
)
else
:
raise
AssertionError
(
'must raise Timeout'
)
gevent
.
sleep
(
0.02
)
def
test_returns_after_timeout
(
self
):
start
=
time
.
time
()
self
.
wait
(
timeout
=
0.01
)
# join simply returns after timeout expires
delay
=
time
.
time
()
-
start
assert
0.01
<=
delay
<
0.01
+
0.01
,
delay
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