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
20b8710e
Commit
20b8710e
authored
6 months ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
fixes
#3
parent
3abdfb2b
No related branches found
No related tags found
No related merge requests found
Pipeline
#63417
failed with stages
in 1 minute and 4 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+7
-7
7 additions, 7 deletions
.gitlab-ci.yml
coolamqp/objects.py
+6
-5
6 additions, 5 deletions
coolamqp/objects.py
tests/test_objects.py
+7
-2
7 additions, 2 deletions
tests/test_objects.py
with
20 additions
and
14 deletions
.gitlab-ci.yml
+
7
−
7
View file @
20b8710e
...
@@ -60,18 +60,18 @@ unittest_select:
...
@@ -60,18 +60,18 @@ unittest_select:
unittest_epoll_python27
:
unittest_epoll_python27
:
extends
:
.before_
test
stage
:
unit
test
image
:
python:2.7
image
:
python:2.7
variables
:
AMQP_HOST
:
"
rabbitmq"
before_script
:
before_script
:
-
pip install nose2 nose2[coverage_plugin]
-
pip install nose2
coverage requests yapf
nose2[coverage_plugin]
-
python setup.py install
-
python setup.py install
script
:
script
:
-
nose2 -F -vv
-
nose2 -F -vv
variables
:
services
:
AMQP_HOST
:
"
rabbitmq"
-
name
:
rabbitmq:3.10-management
after_script
:
alias
:
rabbitmq
-
mv .coverage .coverage.python27epoll
unittest_epoll
:
unittest_epoll
:
extends
:
.before_test
extends
:
.before_test
...
...
This diff is collapsed.
Click to expand it.
coolamqp/objects.py
+
6
−
5
View file @
20b8710e
...
@@ -27,6 +27,8 @@ def toutf8(q):
...
@@ -27,6 +27,8 @@ def toutf8(q):
def
tobytes
(
q
):
def
tobytes
(
q
):
if
isinstance
(
q
,
memoryview
):
return
q
.
tobytes
()
return
q
.
encode
(
'
utf-8
'
)
if
isinstance
(
q
,
six
.
text_type
)
else
q
return
q
.
encode
(
'
utf-8
'
)
if
isinstance
(
q
,
six
.
text_type
)
else
q
...
@@ -287,8 +289,7 @@ class Queue(object):
...
@@ -287,8 +289,7 @@ class Queue(object):
if
name
is
None
:
if
name
is
None
:
self
.
name
=
None
self
.
name
=
None
else
:
else
:
name
=
uuid
.
uuid4
().
hex
if
not
name
else
name
self
.
name
=
tobytes
(
uuid
.
uuid4
().
hex
if
not
name
else
name
)
self
.
name
=
tobytes
(
name
)
self
.
durable
=
durable
self
.
durable
=
durable
self
.
exchange
=
exchange
self
.
exchange
=
exchange
...
@@ -303,9 +304,9 @@ class Queue(object):
...
@@ -303,9 +304,9 @@ class Queue(object):
if
self
.
anonymous
and
(
not
self
.
auto_delete
or
self
.
durable
):
if
self
.
anonymous
and
(
not
self
.
auto_delete
or
self
.
durable
):
raise
ValueError
(
'
Zero sense to make a anonymous non-auto-delete or durable queue
'
)
raise
ValueError
(
'
Zero sense to make a anonymous non-auto-delete or durable queue
'
)
if
not
self
.
anonymous
:
if
not
self
.
anonymous
and
(
self
.
auto_delete
or
self
.
exclusive
)
:
if
self
.
auto_delete
or
self
.
exclusive
:
warnings
.
warn
(
'
This may cause unpredictable behaviour
'
,
UserWarning
)
warnings
.
warn
(
'
This may cause unpredictable behaviour
'
,
UserWarning
)
elif
self
.
durable
:
elif
self
.
durable
:
raise
ValueError
(
'
Cannot declare an anonymous durable queue
'
)
raise
ValueError
(
'
Cannot declare an anonymous durable queue
'
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_objects.py
+
7
−
2
View file @
20b8710e
# coding=UTF-8
# coding=UTF-8
from
__future__
import
print_function
,
absolute_import
,
division
from
__future__
import
print_function
,
absolute_import
,
division
import
sys
import
logging
import
logging
import
unittest
import
unittest
import
io
import
io
...
@@ -13,6 +14,8 @@ from coolamqp.objects import NodeDefinition, MessageProperties, Queue, argumenti
...
@@ -13,6 +14,8 @@ from coolamqp.objects import NodeDefinition, MessageProperties, Queue, argumenti
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
logging
.
getLogger
(
'
coolamqp
'
).
setLevel
(
logging
.
DEBUG
)
logging
.
getLogger
(
'
coolamqp
'
).
setLevel
(
logging
.
DEBUG
)
IS_PY3
=
sys
.
version
.
startswith
(
'
3
'
)
class
TestObjects
(
unittest
.
TestCase
):
class
TestObjects
(
unittest
.
TestCase
):
...
@@ -26,9 +29,11 @@ class TestObjects(unittest.TestCase):
...
@@ -26,9 +29,11 @@ class TestObjects(unittest.TestCase):
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
with
warnings
.
catch_warnings
(
record
=
True
)
as
w
:
Queue
(
'
test
'
,
auto_delete
=
True
,
exclusive
=
True
)
Queue
(
'
test
'
,
auto_delete
=
True
,
exclusive
=
True
)
Queue
(
auto_delete
=
True
,
exclusive
=
False
)
Queue
(
auto_delete
=
True
,
exclusive
=
False
)
self
.
assertEqual
(
len
(
w
),
2
)
logger
.
warning
(
repr
(
w
))
self
.
assertEqual
(
len
(
w
),
2
if
IS_PY3
else
1
)
self
.
assertTrue
(
issubclass
(
w
[
0
].
category
,
UserWarning
))
self
.
assertTrue
(
issubclass
(
w
[
0
].
category
,
UserWarning
))
self
.
assertTrue
(
issubclass
(
w
[
1
].
category
,
DeprecationWarning
))
if
IS_PY3
:
self
.
assertTrue
(
issubclass
(
w
[
1
].
category
,
DeprecationWarning
))
def
test_queue_declare
(
self
):
def
test_queue_declare
(
self
):
args
=
argumentify
({
'
x-dead-letter-exchange
'
:
'
deadletter
'
,
args
=
argumentify
({
'
x-dead-letter-exchange
'
:
'
deadletter
'
,
...
...
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