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
b4a3dc40
Commit
b4a3dc40
authored
Oct 26, 2012
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update test__api.py
- remove test_wait_write_invalid_callback
parent
af0e9eae
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
19 deletions
+30
-19
greentest/test__api.py
greentest/test__api.py
+30
-19
No files found.
greentest/test__api.py
View file @
b4a3dc40
...
@@ -62,25 +62,36 @@ class Test(greentest.TestCase):
...
@@ -62,25 +62,36 @@ class Test(greentest.TestCase):
assert
'Invalid switch'
in
str
(
result
),
repr
(
str
(
result
))
assert
'Invalid switch'
in
str
(
result
),
repr
(
str
(
result
))
switcher
.
kill
()
switcher
.
kill
()
def
test_wait_read_invalid_switch
(
self
):
def
_test_wait_read_invalid_switch
(
self
,
sleep
):
sock
=
socket
.
socket
()
sock1
,
sock2
=
socket
.
socketpair
()
p
=
gevent
.
spawn
(
util
.
wrap_errors
(
AssertionError
,
socket
.
wait_read
),
sock
.
fileno
())
try
:
gevent
.
sleep
(
0
)
lst
=
[]
switcher
=
gevent
.
spawn
(
p
.
switch
,
None
)
gevent
.
get_hub
().
loop
.
run_callback
(
switch_None
,
lst
)
p
=
gevent
.
spawn
(
util
.
wrap_errors
(
AssertionError
,
socket
.
wait_read
),
sock1
.
fileno
())
lst
.
append
(
p
)
if
sleep
is
not
None
:
gevent
.
sleep
(
sleep
)
result
=
p
.
get
()
result
=
p
.
get
()
assert
isinstance
(
result
,
AssertionError
),
result
assert
isinstance
(
result
,
AssertionError
),
result
assert
'Invalid switch'
in
str
(
result
),
repr
(
str
(
result
))
assert
'Invalid switch'
in
str
(
result
),
repr
(
str
(
result
))
switcher
.
kill
()
finally
:
sock1
.
close
()
sock2
.
close
()
def
test_wait_write_invalid_switch
(
self
):
def
test_invalid_switch_None
(
self
):
sock
=
socket
.
socket
()
self
.
_test_wait_read_invalid_switch
(
None
)
p
=
gevent
.
spawn
(
util
.
wrap_errors
(
AssertionError
,
socket
.
wait_write
),
sock
.
fileno
())
gevent
.
sleep
(
0
)
def
test_invalid_switch_0
(
self
):
switcher
=
gevent
.
spawn
(
p
.
switch
,
None
)
self
.
_test_wait_read_invalid_switch
(
0
)
result
=
p
.
get
()
assert
isinstance
(
result
,
AssertionError
),
result
def
test_invalid_switch_1
(
self
):
assert
'Invalid switch'
in
str
(
result
),
repr
(
str
(
result
))
self
.
_test_wait_read_invalid_switch
(
0.001
)
switcher
.
kill
()
# we don't test wait_write the same way, because socket is always ready to write
def
switch_None
(
g
):
g
[
0
].
switch
(
None
)
class
TestTimers
(
greentest
.
TestCase
):
class
TestTimers
(
greentest
.
TestCase
):
...
...
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