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
e0b0d41c
Commit
e0b0d41c
authored
Apr 22, 2010
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rewrite the test to make it nicer
parent
f845dca9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
+20
-10
greentest/test__greenletset.py
greentest/test__greenletset.py
+20
-10
No files found.
greentest/test__greenletset.py
View file @
e0b0d41c
...
...
@@ -71,26 +71,36 @@ class Test(greentest.TestCase):
u2
=
Undead
()
p1
=
gevent
.
spawn
(
u1
)
p2
=
gevent
.
spawn
(
u2
)
def
check
(
count1
,
count2
):
assert
p1
,
p1
assert
p2
,
p2
assert
not
p1
.
dead
,
p1
assert
not
p2
.
dead
,
p2
self
.
assertEqual
(
u1
.
shot_count
,
count1
)
self
.
assertEqual
(
u2
.
shot_count
,
count2
)
gevent
.
sleep
(
0.01
)
s
=
pool
.
GreenletSet
([
p1
,
p2
])
assert
u1
.
shot_count
==
0
,
u1
.
shot_count
assert
len
(
s
)
==
2
,
s
check
(
0
,
0
)
s
.
killone
(
p1
)
assert
u1
.
shot_count
==
0
,
u1
.
shot_count
check
(
0
,
0
)
gevent
.
sleep
(
0
)
assert
u1
.
shot_count
==
1
,
u1
.
shot_count
check
(
1
,
0
)
s
.
killone
(
p1
)
assert
u1
.
shot_count
==
1
,
u1
.
shot_count
check
(
1
,
0
)
s
.
killone
(
p1
)
assert
u2
.
shot_count
==
0
,
u2
.
shot_count
check
(
1
,
0
)
s
.
kill
()
s
.
kill
()
s
.
kill
()
assert
u1
.
shot_count
==
1
,
u1
.
shot_count
assert
u2
.
shot_count
==
0
,
u2
.
shot_count
check
(
1
,
0
)
gevent
.
sleep
(
DELAY
)
assert
u1
.
shot_count
==
1
,
u1
.
shot_count
assert
u2
.
shot_count
==
1
,
u2
.
shot_count
check
(
1
,
1
)
X
=
object
()
assert
X
is
gevent
.
with_timeout
(
DELAY
,
s
.
kill
,
block
=
True
,
timeout_value
=
X
)
kill_result
=
gevent
.
with_timeout
(
DELAY
,
s
.
kill
,
block
=
True
,
timeout_value
=
X
)
assert
kill_result
is
X
,
repr
(
kill_result
)
assert
len
(
s
)
==
2
,
s
check
(
1
,
1
)
def
test_killall_subclass
(
self
):
p1
=
GreenletSubclass
.
spawn
(
lambda
:
1
/
0
)
...
...
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