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
b4e7de60
Commit
b4e7de60
authored
8 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
compat with context manager protocol
parent
51bfe4e1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
setup.py
+10
-7
10 additions, 7 deletions
setup.py
tests/test_performance.py
+46
-0
46 additions, 0 deletions
tests/test_performance.py
with
56 additions
and
7 deletions
setup.py
+
10
−
7
View file @
b4e7de60
#!/usr/bin/env python
#!/usr/bin/env python
#coding=UTF-8
#
coding=UTF-8
from
distutils.core
import
setup
from
setuptools
import
setup
setup
(
name
=
'
CoolAMQP
'
,
setup
(
name
=
'
CoolAMQP
'
,
version
=
'
0.
6
'
,
version
=
'
0.
7
'
,
description
=
u
'
The reconnecting AMQP client
'
,
description
=
u
'
AMQP client with sane reconnects
'
,
author
=
u
'
DMS Serwis s.c.
'
,
author
=
u
'
DMS Serwis s.c.
'
,
author_email
=
'
piotrm@smok.co
'
,
author_email
=
'
piotrm@smok.co
'
,
url
=
'
https://github.com/smok-serwis/coolamqp
'
,
url
=
'
https://github.com/smok-serwis/coolamqp
'
,
download_url
=
'
https://github.com/smok-serwis/coolamqp/archive/
master
.zip
'
,
download_url
=
'
https://github.com/smok-serwis/coolamqp/archive/
v0.7
.zip
'
,
keywords
=
[
'
amqp
'
,
'
pyamqp
'
,
'
rabbitmq
'
,
'
client
'
,
'
network
'
,
'
ha
'
,
'
high availability
'
],
keywords
=
[
'
amqp
'
,
'
pyamqp
'
,
'
rabbitmq
'
,
'
client
'
,
'
network
'
,
'
ha
'
,
'
high availability
'
],
packages
=
[
'
coolamqp
'
,
'
coolamqp.backends
'
],
packages
=
[
'
coolamqp
'
,
'
coolamqp.backends
'
],
license
=
'
MIT License
'
,
license
=
'
MIT License
'
,
long_description
=
u
'
The AMQP client that handles reconnection madness for you
'
,
long_description
=
u
'
The AMQP client that handles reconnection madness for you
'
,
requires
=
[
requires
=
[
"
amqp
"
,
"
amqp
"
,
"
six
"
"
six
"
,
"
monotonic
"
],
],
tests_require
=
[
"
nose
"
],
test_suite
=
'
nose.collector
'
,
classifiers
=
[
classifiers
=
[
'
Programming Language :: Python
'
,
'
Programming Language :: Python
'
,
'
Programming Language :: Python :: 2.7
'
,
'
Programming Language :: Python :: 2.7
'
,
...
@@ -26,4 +29,4 @@ setup(name='CoolAMQP',
...
@@ -26,4 +29,4 @@ setup(name='CoolAMQP',
'
Programming Language :: Python :: Implementation :: PyPy
'
,
'
Programming Language :: Python :: Implementation :: PyPy
'
,
'
Operating System :: OS Independent
'
'
Operating System :: OS Independent
'
]
]
)
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tests/test_performance.py
0 → 100644
+
46
−
0
View file @
b4e7de60
#coding=UTF-8
from
__future__
import
absolute_import
,
division
,
print_function
import
unittest
import
six
import
time
from
coolamqp
import
Cluster
,
ClusterNode
,
Queue
,
MessageReceived
,
ConnectionUp
,
\
ConnectionDown
,
ConsumerCancelled
,
Message
,
Exchange
class
TestBasics
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
amqp
=
Cluster
([
ClusterNode
(
'
127.0.0.1
'
,
'
guest
'
,
'
guest
'
)])
self
.
amqp
.
start
()
self
.
assertIsInstance
(
self
.
amqp
.
drain
(
1
),
ConnectionUp
)
def
tearDown
(
self
):
self
.
amqp
.
shutdown
()
def
takes_less_than
(
self
,
max_time
):
"""
Tests that your code executes in less time than specified value.
Use like:
with self.takes_less_than(0.9):
my_operation()
:param max_time: in seconds
"""
test
=
self
class
CM
(
object
):
def
__enter__
(
self
):
self
.
started_at
=
time
.
time
()
def
__exit__
(
self
,
tp
,
v
,
tb
):
test
.
assertLess
(
time
.
time
()
-
self
.
started_at
,
max_time
)
return
False
return
CM
()
def
test_sending_a_message
(
self
):
with
self
.
takes_less_than
(
0.5
):
self
.
amqp
.
send
(
Message
(
''
),
routing_key
=
'
nowhere
'
).
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