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
9a514c89
Commit
9a514c89
authored
Nov 08, 2017
by
Ron Rothman
Committed by
Jason Madden
Nov 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added tests for new Pool.add parameters, blocking and timeout
parent
12893eec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
src/greentest/test__pool.py
src/greentest/test__pool.py
+41
-0
No files found.
src/greentest/test__pool.py
View file @
9a514c89
...
...
@@ -3,6 +3,7 @@ import gevent
from
gevent
import
pool
from
gevent.event
import
Event
from
gevent.queue
import
Queue
from
gevent.timeout
import
Timeout
import
greentest
import
random
from
greentest
import
ExpectedException
...
...
@@ -204,6 +205,46 @@ class PoolBasicTests(greentest.TestCase):
finally
:
first
.
kill
()
def
test_add_method_non_blocking
(
self
):
p
=
self
.
klass
(
size
=
1
)
first
=
gevent
.
spawn
(
gevent
.
sleep
,
1000
)
try
:
second
=
gevent
.
spawn
(
gevent
.
sleep
,
1000
)
try
:
p
.
add
(
first
)
try
:
p
.
add
(
second
,
blocking
=
False
)
except
pool
.
Full
:
pass
# expected
except
Exception
:
raise
AssertionError
(
'Expected pool.Full'
)
else
:
raise
AssertionError
(
'Expected pool.Full'
)
finally
:
second
.
kill
()
finally
:
first
.
kill
()
def
test_add_method_timeout
(
self
):
p
=
self
.
klass
(
size
=
1
)
first
=
gevent
.
spawn
(
gevent
.
sleep
,
1000
)
try
:
second
=
gevent
.
spawn
(
gevent
.
sleep
,
1000
)
try
:
p
.
add
(
first
)
try
:
p
.
add
(
second
,
timeout
=
0.100
)
except
Timeout
:
pass
# expected
except
Exception
:
raise
AssertionError
(
'expected Timeout'
)
else
:
raise
AssertionError
(
'expected Timeout'
)
finally
:
second
.
kill
()
finally
:
first
.
kill
()
def
test_apply
(
self
):
p
=
self
.
klass
()
result
=
p
.
apply
(
lambda
a
:
(
'foo'
,
a
),
(
1
,
))
...
...
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