Skip to content

Commit

Permalink
add pylama and fixes for linter
Browse files Browse the repository at this point in the history
  • Loading branch information
mosquito committed Apr 2, 2017
1 parent 67ca392 commit dbbf87e
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 28 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ matrix:
env: TOXENV=py35
- python: 3.6
env: TOXENV=py36

install:
- pip install tox coveralls
script:
Expand Down
8 changes: 3 additions & 5 deletions aio_pika/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ def close(self) -> None:

@asyncio.coroutine
def connect(url: str=None, *, host: str='localhost',
port: int=5672, login: str='guest',
password: str='guest', virtualhost: str='/',
ssl: bool=False, loop=None, **kwargs) -> Connection:
port: int=5672, login: str='guest',
password: str='guest', virtualhost: str='/',
ssl: bool=False, loop=None, **kwargs) -> Connection:
""" Make connection to the broker
:param url: `RFC3986`_ formatted broker address. When :class:`None` will be used keyword arguments.
Expand Down Expand Up @@ -220,5 +220,3 @@ def connect_url(url: str, loop=None) -> Connection:


__all__ = ('connect', 'connect_url', 'Connection')


5 changes: 5 additions & 0 deletions pylama.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pylama]
ignore=E402,W0401,E712,E722,C901,E0603,E711

[pylama:pycodestyle]
max_line_length = 120
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: PyPy',
'Programming Language :: Python :: Implementation :: CPython',
],
packages=find_packages(exclude=['tests']),
Expand All @@ -48,6 +50,7 @@
'asynctest',
'coverage!=4.3',
'coveralls',
'pylama',
'pytest',
'pytest-asyncio',
'pytest-cov',
Expand Down
15 changes: 7 additions & 8 deletions tests/test_amqp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest
import shortuuid
import aio_pika.exceptions
from aio_pika import connect, connect_url, Message, Connection, Channel, Exchange
from aio_pika import connect, connect_url, Message
from aio_pika.exceptions import ProbableAuthenticationError, MessageProcessError
from aio_pika.exchange import ExchangeType
from aio_pika.tools import wait
Expand Down Expand Up @@ -32,8 +32,8 @@ def test_connection_url_deprecated(self):
def test_channel_close(self):
client = yield from connect(AMQP_URL, loop=self.loop)

queue_name = self.get_random_name("test_connection")
routing_key = self.get_random_name()
self.get_random_name("test_connection")
self.get_random_name()

self.__closed = False

Expand Down Expand Up @@ -127,12 +127,12 @@ def test_context_process(self):
incoming_message = yield from queue.get(timeout=5)

with self.assertRaises(AssertionError):
with incoming_message.proccess(requeue=True) as msg:
with incoming_message.proccess(requeue=True):
raise AssertionError

incoming_message = yield from queue.get(timeout=5)

with incoming_message.proccess() as msg:
with incoming_message.proccess():
pass

self.assertEqual(incoming_message.body, body)
Expand Down Expand Up @@ -208,7 +208,6 @@ def test_reject_twice(self):
yield from queue.delete()
yield from wait((client.close(), client.closing), loop=self.loop)


@pytest.mark.asyncio
def test_consuming(self):
client = yield from connect(AMQP_URL, loop=self.loop)
Expand Down Expand Up @@ -417,7 +416,7 @@ def test_exchange_delete(self):

@pytest.mark.asyncio
def test_dlx(self):
client = yield from connect(AMQP_URL, loop=self.loop) # type: Connection
client = yield from connect(AMQP_URL, loop=self.loop)
direct_queue_name = self.get_random_name("test_dlx", "direct")
dlx_queue_name = self.get_random_name("test_dlx", "dlx")

Expand Down Expand Up @@ -483,7 +482,7 @@ def test_connection_close(self):
routing_key = self.get_random_name()

channel = yield from client.channel() # type: Channel
exchange = yield from channel.declare_exchange('direct', auto_delete=True) # type: Exchange
exchange = yield from channel.declare_exchange('direct', auto_delete=True)

try:
with self.assertRaises(aio_pika.exceptions.ChannelClosed):
Expand Down
21 changes: 7 additions & 14 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py3{4,5,6},qa
envlist = py3{4,5,6}

[testenv]
setenv =
Expand All @@ -11,17 +11,10 @@ extras =
develop

commands=
py.test --cov aio_pika --cov-report=term-missing tests
py.test \
--cov aio_pika \
--cov-report=term-missing \
--pylama aio_pika \
--pylama tests \
tests
coveralls


[testenv:qa]
basepython = python3.5

skip_install = True

deps =
coala-bears>=0.9

commands =
coala --non-interactive

0 comments on commit dbbf87e

Please sign in to comment.