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
7cef8181
Commit
7cef8181
authored
Mar 23, 2018
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use standard delay times in test__event.py. Fixes #1148 (hopefully).
parent
090b360a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
src/greentest/test__event.py
src/greentest/test__event.py
+11
-10
No files found.
src/greentest/test__event.py
View file @
7cef8181
...
@@ -4,12 +4,14 @@ import gevent
...
@@ -4,12 +4,14 @@ import gevent
from
gevent.event
import
Event
,
AsyncResult
from
gevent.event
import
Event
,
AsyncResult
import
greentest
import
greentest
from
greentest.skipping
import
skipUnderCoverage
from
greentest.six
import
xrange
from
greentest.six
import
xrange
from
greentest.timing
import
AbstractGenericGetTestCase
from
greentest.timing
import
AbstractGenericGetTestCase
from
greentest.timing
import
AbstractGenericWaitTestCase
from
greentest.timing
import
AbstractGenericWaitTestCase
from
greentest.timing
import
SMALL_TICK
from
greentest.timing
import
SMALL_TICK_MAX_ADJ
DELAY
=
0.01
DELAY
=
SMALL_TICK
+
SMALL_TICK_MAX_ADJ
class
TestEventWait
(
AbstractGenericWaitTestCase
):
class
TestEventWait
(
AbstractGenericWaitTestCase
):
...
@@ -105,21 +107,20 @@ class TestAsyncResult(greentest.TestCase):
...
@@ -105,21 +107,20 @@ class TestAsyncResult(greentest.TestCase):
gevent
.
sleep
(
0
)
gevent
.
sleep
(
0
)
self
.
assertEqual
(
log
,
[(
'caught'
,
obj
)])
self
.
assertEqual
(
log
,
[(
'caught'
,
obj
)])
@
skipUnderCoverage
(
"This test is racy and sometimes fails"
)
def
test_set
(
self
):
def
test_set
(
self
):
event1
=
AsyncResult
()
event1
=
AsyncResult
()
timer_exc
=
MyException
(
'interrupted'
)
timer_exc
=
MyException
(
'interrupted'
)
# Notice that this test is racy
# Notice that this test is racy:
# After DELAY, we set the event. We also try to immediately
# raise the exception with a timer of 0 --- but that depends
# on cycling the loop. Hence the fairly large value for DELAY.
g
=
gevent
.
spawn_later
(
DELAY
,
event1
.
set
,
'hello event1'
)
g
=
gevent
.
spawn_later
(
DELAY
,
event1
.
set
,
'hello event1'
)
t
=
gevent
.
Timeout
.
start_new
(
0
,
timer_exc
)
self
.
_close_on_teardown
(
g
.
kill
)
try
:
with
gevent
.
Timeout
.
start_new
(
0
,
timer_exc
)
:
with
self
.
assertRaises
(
MyException
)
as
exc
:
with
self
.
assertRaises
(
MyException
)
as
exc
:
event1
.
get
()
event1
.
get
()
self
.
assertEqual
(
timer_exc
,
exc
.
exception
)
self
.
assertIs
(
timer_exc
,
exc
.
exception
)
finally
:
t
.
close
()
g
.
kill
()
def
test_set_with_timeout
(
self
):
def
test_set_with_timeout
(
self
):
event2
=
AsyncResult
()
event2
=
AsyncResult
()
...
...
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