diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..e3014e6 --- /dev/null +++ b/.flake8 @@ -0,0 +1,3 @@ +[flake8] +max-line-length = 100 +exclude = .git,src,build,doc/conf.py diff --git a/.travis.yml b/.travis.yml index adc5199..4bf3c56 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,3 +12,4 @@ install: - pip install . script: - pytest --forked + - flake8 diff --git a/birdisle/__init__.py b/birdisle/__init__.py index e44e527..3d13ff3 100644 --- a/birdisle/__init__.py +++ b/birdisle/__init__.py @@ -4,7 +4,7 @@ import os from . import _birdisle -from ._version import __version__ +from ._version import __version__ # noqa: F401 class Server(object): diff --git a/builder.py b/builder.py index a7f080f..534954f 100755 --- a/builder.py +++ b/builder.py @@ -16,9 +16,8 @@ void birdisleAddConnection(birdisleServer *handle, int fd); """) -ffibuilder.set_source("birdisle._birdisle", """ - #include "birdisle.h" -""", +ffibuilder.set_source( + "birdisle._birdisle", '#include "birdisle.h"\n', libraries=['birdisle'], include_dirs=['src/src'], library_dirs=['src/src'], diff --git a/requirements.in b/requirements.in index 284d70e..86a107f 100644 --- a/requirements.in +++ b/requirements.in @@ -2,6 +2,7 @@ cffi redis pytest pytest-forked +flake8 aioredis; python_version>="3.5" pytest-asyncio; python_version>="3.5" diff --git a/requirements.txt b/requirements.txt index 9abd101..67c8764 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,14 +10,17 @@ async-timeout==2.0.1 ; python_version >= "3.5" atomicwrites==1.2.1 # via pytest attrs==18.2.0 # via pytest cffi==1.11.5 +flake8==3.5.0 hiredis==0.2.0 # via aioredis +mccabe==0.6.1 # via flake8 more-itertools==4.3.0 # via pytest -pathlib2==2.3.2 # via pytest pluggy==0.7.1 # via pytest py==1.7.0 # via pytest +pycodestyle==2.3.1 # via flake8 pycparser==2.19 # via cffi +pyflakes==1.6.0 # via flake8 pytest-asyncio==0.9.0 ; python_version >= "3.5" pytest-forked==0.2 pytest==3.8.2 redis==2.10.6 -six==1.11.0 # via more-itertools, pathlib2, pytest +six==1.11.0 # via more-itertools, pytest diff --git a/tests/conftest.py b/tests/conftest.py index 2938bac..69f3f7e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,4 +4,3 @@ collect_ignore = [] if sys.version_info < (3, 5): collect_ignore.append('test_aioredis.py') - diff --git a/tests/test_aioredis.py b/tests/test_aioredis.py index 57ebd68..f63559b 100644 --- a/tests/test_aioredis.py +++ b/tests/test_aioredis.py @@ -69,6 +69,7 @@ async def test_create_redis(r): val = await r.get('hello') assert val == b'world' + @pytest.mark.asyncio async def test_pubsub(redis_pool): res = await redis_pool.subscribe('chan') diff --git a/tests/test_birdisle.py b/tests/test_birdisle.py index 3d7f9a0..295ea76 100644 --- a/tests/test_birdisle.py +++ b/tests/test_birdisle.py @@ -1,7 +1,6 @@ import time import threading import locale -import socket import resource import signal