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
8c0f741f
Commit
8c0f741f
authored
Feb 19, 2014
by
Fantix King
Committed by
Denis Bilenko
Apr 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes test_queue.py for PY3
parent
dee1219a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
gevent/queue.py
gevent/queue.py
+5
-1
greentest/test_queue.py
greentest/test_queue.py
+12
-12
No files found.
gevent/queue.py
View file @
8c0f741f
...
...
@@ -33,7 +33,7 @@ Full = __queue__.Full
Empty
=
__queue__
.
Empty
from
gevent.timeout
import
Timeout
from
gevent.hub
import
get_hub
,
Waiter
,
getcurrent
from
gevent.hub
import
get_hub
,
Waiter
,
getcurrent
,
PY3
__all__
=
[
'Queue'
,
'PriorityQueue'
,
'LifoQueue'
,
'JoinableQueue'
,
'Channel'
]
...
...
@@ -285,6 +285,10 @@ class Queue(object):
raise
result
return
result
if
PY3
:
__next__
=
next
del
next
class
ItemWaiter
(
Waiter
):
__slots__
=
[
'item'
,
'queue'
]
...
...
greentest/test_queue.py
View file @
8c0f741f
...
...
@@ -108,22 +108,22 @@ class BaseQueueTest(unittest.TestCase, BlockingTestMixin):
q
.
put
(
i
)
self
.
assert_
(
not
q
.
empty
(),
"Queue should not be empty"
)
self
.
assert_
(
not
q
.
full
(),
"Queue should not be full"
)
q
.
put
(
"last"
)
q
.
put
(
999
)
self
.
assert_
(
q
.
full
(),
"Queue should be full"
)
try
:
q
.
put
(
"full"
,
block
=
0
)
q
.
put
(
888
,
block
=
0
)
self
.
fail
(
"Didn't appear to block with a full queue"
)
except
Queue
.
Full
:
pass
try
:
q
.
put
(
"full"
,
timeout
=
0.01
)
q
.
put
(
888
,
timeout
=
0.01
)
self
.
fail
(
"Didn't appear to time-out with a full queue"
)
except
Queue
.
Full
:
pass
self
.
assertEquals
(
q
.
qsize
(),
QUEUE_SIZE
)
# Test a blocking put
self
.
do_blocking_test
(
q
.
put
,
(
"full"
,),
q
.
get
,
())
self
.
do_blocking_test
(
q
.
put
,
(
"full"
,
True
,
10
),
q
.
get
,
())
self
.
do_blocking_test
(
q
.
put
,
(
888
,),
q
.
get
,
())
self
.
do_blocking_test
(
q
.
put
,
(
888
,
True
,
10
),
q
.
get
,
())
# Empty it
for
i
in
range
(
QUEUE_SIZE
):
q
.
get
()
...
...
@@ -249,36 +249,36 @@ class FailingQueueTest(unittest.TestCase, BlockingTestMixin):
self
.
fail
(
"The queue didn't fail when it should have"
)
except
FailingQueueException
:
pass
q
.
put
(
"last"
)
q
.
put
(
999
)
self
.
assert_
(
q
.
full
(),
"Queue should be full"
)
# Test a failing blocking put
q
.
fail_next_put
=
True
try
:
self
.
do_blocking_test
(
q
.
put
,
(
"full"
,),
q
.
get
,
())
self
.
do_blocking_test
(
q
.
put
,
(
888
,),
q
.
get
,
())
self
.
fail
(
"The queue didn't fail when it should have"
)
except
FailingQueueException
:
pass
# Check the Queue isn't damaged.
# put failed, but get succeeded - re-add
q
.
put
(
"last"
)
q
.
put
(
999
)
# Test a failing timeout put
q
.
fail_next_put
=
True
try
:
self
.
do_exceptional_blocking_test
(
q
.
put
,
(
"full"
,
True
,
10
),
q
.
get
,
(),
self
.
do_exceptional_blocking_test
(
q
.
put
,
(
888
,
True
,
10
),
q
.
get
,
(),
FailingQueueException
)
self
.
fail
(
"The queue didn't fail when it should have"
)
except
FailingQueueException
:
pass
# Check the Queue isn't damaged.
# put failed, but get succeeded - re-add
q
.
put
(
"last"
)
q
.
put
(
999
)
self
.
assert_
(
q
.
full
(),
"Queue should be full"
)
q
.
get
()
self
.
assert_
(
not
q
.
full
(),
"Queue should not be full"
)
q
.
put
(
"last"
)
q
.
put
(
999
)
self
.
assert_
(
q
.
full
(),
"Queue should be full"
)
# Test a blocking put
self
.
do_blocking_test
(
q
.
put
,
(
"full"
,),
q
.
get
,
())
self
.
do_blocking_test
(
q
.
put
,
(
888
,),
q
.
get
,
())
# Empty it
for
i
in
range
(
QUEUE_SIZE
):
q
.
get
()
...
...
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