Skip to content
Snippets Groups Projects
Commit 9e9959b3 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

python 3

parent 96111fc6
No related branches found
No related tags found
No related merge requests found
...@@ -91,3 +91,4 @@ ENV/ ...@@ -91,3 +91,4 @@ ENV/
.vagrant/ .vagrant/
.idea/ .idea/
MANIFEST
language: python language: python
python: python:
- "2.7" - "2.7"
- "3.2"
- "3.3"
- "3.4"
- "3.5
- "pypy" - "pypy"
cache: pip cache: pip
sudo: required sudo: required
......
...@@ -8,8 +8,6 @@ CoolAMQP ...@@ -8,8 +8,6 @@ CoolAMQP
[![PyPI](https://img.shields.io/pypi/pyversions/CoolAMQP.svg)]() [![PyPI](https://img.shields.io/pypi/pyversions/CoolAMQP.svg)]()
[![PyPI](https://img.shields.io/pypi/implementation/CoolAMQP.svg)]() [![PyPI](https://img.shields.io/pypi/implementation/CoolAMQP.svg)]()
**Support for Python 3 is suspended until I fix pending issues**
When you're tired of fucking with AMQP reconnects. When you're tired of fucking with AMQP reconnects.
When a connection made by CoolAMQP to your broker fails, it will pick another When a connection made by CoolAMQP to your broker fails, it will pick another
......
...@@ -13,8 +13,11 @@ Vagrant.configure("2") do |config| ...@@ -13,8 +13,11 @@ Vagrant.configure("2") do |config|
config.vm.provision "shell", inline: <<-SHELL config.vm.provision "shell", inline: <<-SHELL
apt-get update apt-get update
apt-get install -y htop curl python python-setuptools python-pip python-dev build-essential rabbitmq-server
# Python
apt-get install -y htop curl python python-setuptools python-pip python-dev build-essential rabbitmq-server python3 python3-pip python3-setuptools
pip install --upgrade pip setuptools pip install --upgrade pip setuptools
pip3 install --upgrade pip setuptools
/usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management
sudo service rabbitmq-server restart sudo service rabbitmq-server restart
...@@ -25,6 +28,8 @@ Vagrant.configure("2") do |config| ...@@ -25,6 +28,8 @@ Vagrant.configure("2") do |config|
# Install deps # Install deps
pip install -r /vagrant/requirements.txt pip install -r /vagrant/requirements.txt
pip install nose coverage pip install nose coverage
pip3 install -r /vagrant/requirements.txt
pip3 install nose coverage
# HTTP server for viewing coverage reports # HTTP server for viewing coverage reports
apt-get -y install nginx apt-get -y install nginx
......
...@@ -9,6 +9,7 @@ class ConnectionFailedError(AMQPError): ...@@ -9,6 +9,7 @@ class ConnectionFailedError(AMQPError):
class Cancelled(Exception): class Cancelled(Exception):
"""Cancel ordered by user""" """Cancel ordered by user"""
class RemoteAMQPError(AMQPError): class RemoteAMQPError(AMQPError):
""" """
Remote AMQP broker responded with an error code Remote AMQP broker responded with an error code
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
from __future__ import division from __future__ import division
import amqp import amqp
import socket import socket
import six
import functools import functools
import logging import logging
from .base import AMQPBackend, RemoteAMQPError, ConnectionFailedError from .base import AMQPBackend, RemoteAMQPError, ConnectionFailedError
...@@ -21,7 +22,8 @@ def translate_exceptions(fun): ...@@ -21,7 +22,8 @@ def translate_exceptions(fun):
except amqp.RecoverableChannelError as e: except amqp.RecoverableChannelError as e:
raise RemoteAMQPError(e.reply_code, e.reply_text) raise RemoteAMQPError(e.reply_code, e.reply_text)
except (IOError, amqp.ConnectionForced, amqp.IrrecoverableChannelError) as e: except (IOError, amqp.ConnectionForced, amqp.IrrecoverableChannelError) as e:
raise ConnectionFailedError(e.message) msg = e.message if six.PY2 else e.args[0]
raise ConnectionFailedError(msg)
return q return q
......
...@@ -2,10 +2,16 @@ ...@@ -2,10 +2,16 @@
# coding=UTF-8 # coding=UTF-8
from setuptools import setup from setuptools import setup
def reqs():
with open('requirements.txt', 'r') as fin:
return [q.strip() for q in fin.readlines() if len(q.strip()) > 0]
setup(name='CoolAMQP', setup(name='CoolAMQP',
version='0.7', version='0.7',
description=u'AMQP client with sane reconnects', description='AMQP client with sane reconnects',
author=u'DMS Serwis s.c.', author='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/v0.7.zip', download_url='https://github.com/smok-serwis/coolamqp/archive/v0.7.zip',
...@@ -13,18 +19,16 @@ setup(name='CoolAMQP', ...@@ -13,18 +19,16 @@ setup(name='CoolAMQP',
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=reqs(),
"amqp",
"six",
"monotonic"
],
tests_require=["nose"], tests_require=["nose"],
test_suite='nose.collector', test_suite='nose.collector',
classifiers=[ classifiers=[
'Programming Language :: Python', 'Programming Language :: Python',
'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2.7',
# 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.2',
# 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy', 'Programming Language :: Python :: Implementation :: PyPy',
'Operating System :: OS Independent' 'Operating System :: OS Independent'
......
...@@ -3,8 +3,7 @@ from __future__ import absolute_import, division, print_function ...@@ -3,8 +3,7 @@ from __future__ import absolute_import, division, print_function
import unittest import unittest
import six import six
from coolamqp import Cluster, ClusterNode, Queue, MessageReceived, ConnectionUp, \ from coolamqp import Cluster, ClusterNode, Queue, MessageReceived, ConnectionUp, ConsumerCancelled, Message, Exchange
ConnectionDown, ConsumerCancelled, Message, Exchange
def getamqp(): def getamqp():
...@@ -55,7 +54,7 @@ class TestBasics(unittest.TestCase): ...@@ -55,7 +54,7 @@ class TestBasics(unittest.TestCase):
p = self.amqp.drain(wait=4) p = self.amqp.drain(wait=4)
self.assertIsInstance(p, MessageReceived) self.assertIsInstance(p, MessageReceived)
self.assertEquals(six.binary_type(p.message.body), 'what the fuck') self.assertEquals(six.text_type(p.message.body), 'what the fuck')
def test_bug_hangs(self): def test_bug_hangs(self):
p = Queue('lol', exclusive=True) p = Queue('lol', exclusive=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment