Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coolamqp
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
coolamqp
Commits
029732c7
Commit
029732c7
authored
6 months ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
fix for unit tests
parent
720037a0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#62603
failed with stages
Stage: unittest
Stage: build
in 1 minute and 44 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
coolamqp/__init__.py
+1
-1
1 addition, 1 deletion
coolamqp/__init__.py
coolamqp/objects.py
+6
-1
6 additions, 1 deletion
coolamqp/objects.py
tests/test_clustering/test_topic_exchanges.py
+51
-0
51 additions, 0 deletions
tests/test_clustering/test_topic_exchanges.py
with
59 additions
and
2 deletions
CHANGELOG.md
+
1
−
0
View file @
029732c7
...
...
@@ -5,6 +5,7 @@ Since v1.3.2 they'll be put here and in release description.
========
*
added docs regarding consume method.
*
added testing topic exchanges
# v1.4.1
=======
...
...
This diff is collapsed.
Click to expand it.
coolamqp/__init__.py
+
1
−
1
View file @
029732c7
__version__
=
'
1.4.2a
1
'
__version__
=
'
1.4.2a
2
'
This diff is collapsed.
Click to expand it.
coolamqp/objects.py
+
6
−
1
View file @
029732c7
...
...
@@ -244,7 +244,8 @@ class Queue(object):
:param exclusive: Is this queue exclusive?
:param auto_delete: Is this queue auto_delete ?
:param arguments: either a list of (bytes, values) or a dict of (str, value) to pass as an extra argument
:warn PendingDeprecationWarning: if a non-exclusive auto_delete queue is created
:warning PendingDeprecationWarning: if a non-exclusive auto_delete queue is created or some other combinations
that will be soon unavailable (eg. RabbitMQ 4.0).
"""
__slots__
=
(
'
name
'
,
'
durable
'
,
'
exchange
'
,
'
auto_delete
'
,
'
exclusive
'
,
'
anonymous
'
,
'
consumer_tag
'
,
'
arguments
'
)
...
...
@@ -265,6 +266,10 @@ class Queue(object):
self
.
auto_delete
=
auto_delete
self
.
exclusive
=
exclusive
self
.
arguments
=
argumentify
(
arguments
)
if
self
.
auto_delete
and
self
.
durable
:
warnings
.
warn
(
'
This will be removed in RabbitMQ 4.0
'
,
PendingDeprecationWarning
)
if
self
.
auto_delete
and
not
self
.
exclusive
:
warnings
.
warn
(
'
This will be removed in RabbitMQ 4.0
'
,
PendingDeprecationWarning
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_clustering/test_topic_exchanges.py
0 → 100644
+
51
−
0
View file @
029732c7
import
time
import
os
import
unittest
import
logging
import
monotonic
from
coolamqp.clustering
import
Cluster
from
coolamqp.objects
import
Exchange
,
Queue
,
NodeDefinition
,
Message
XCHG
=
Exchange
(
'
topic
'
,
type
=
'
topic
'
,
durable
=
True
)
QUEUE
=
Queue
(
exchange
=
XCHG
,
exclusive
=
True
,
auto_delete
=
True
)
NODE
=
NodeDefinition
(
os
.
environ
.
get
(
'
AMQP_HOST
'
,
'
127.0.0.1
'
),
'
guest
'
,
'
guest
'
,
heartbeat
=
20
)
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
class
TestTopic
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
c
=
Cluster
([
NODE
])
self
.
c
.
start
()
def
tearDown
(
self
):
self
.
c
.
shutdown
()
def
test_bind_stuff
(
self
):
self
.
c
.
declare
(
QUEUE
).
result
()
self
.
c
.
bind
(
QUEUE
,
XCHG
,
routing_key
=
'
hello-world
'
)
did_receive
=
False
def
do
(
msg
):
nonlocal
did_receive
did_receive
=
True
msg
.
ack
()
cons
,
fut
=
self
.
c
.
consume
(
QUEUE
,
on_message
=
do
,
no_ack
=
False
)
fut
.
result
()
self
.
c
.
publish
(
Message
(
b
'
good boy
'
),
exchange
=
XCHG
,
routing_key
=
'
hello-world
'
)
start
=
monotonic
.
monotonic
()
while
not
did_receive
:
time
.
sleep
(
2
)
if
monotonic
.
monotonic
()
-
start
>
10
:
self
.
fail
(
"
Message not received within 10 seconds
"
)
self
.
cons
.
cancel
.
result
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment