From 36b385be699c02a582d28e3a4594bec2c01b699f Mon Sep 17 00:00:00 2001 From: Matt <2184696+mrasband@users.noreply.github.com> Date: Tue, 10 Dec 2019 16:42:48 -0700 Subject: [PATCH] Testing updates (#7) * Silence pylint warning about redislock having too many members * Remove deprecated loop kwarg to aioredis factory * Enable python 3.8 testing with tox * Add python-version to repo for explicitness * Set junit_family for pytest deprecations * Explicitly support python 3.8 --- .circleci/config.yml | 47 ++++++++++++++++++++++++++++++++++++++++-- .gitignore | 1 - .python-version | 2 ++ aioredis_lock/locks.py | 2 +- pytest.ini | 2 ++ setup.py | 1 + tests/test_locks.py | 4 ++-- tox.ini | 3 ++- 8 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 .python-version create mode 100644 pytest.ini diff --git a/.circleci/config.yml b/.circleci/config.yml index 7245922..e802c21 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2 jobs: - build: + build-3.7: &build parallelism: 1 working_directory: ~/app docker: @@ -27,7 +27,7 @@ jobs: - run: | source .venv/bin/activate - tox + tox -e py37,fmt,lint - save_cache: key: 'tox-{{ checksum "tox.ini" }}-{{ checksum "setup.py" }}' @@ -36,3 +36,46 @@ jobs: - store_test_results: path: .tox/py37/artifacts/ + + build-3.8: + parallelism: 1 + working_directory: ~/app + docker: + - image: circleci/python:3.8.0-node-browsers + steps: + - checkout + - restore_cache: + keys: + - 'venv-3.8' + - restore_cache: + keys: + - 'tox-3.8-{{ checksum "tox.ini" }}-{{ checksum "setup.py" }}' + + - run: | + python3 -m venv .venv + source .venv/bin/activate + pip install -U tox + + - save_cache: + key: 'venv-3.8' + paths: + - .venv + + - run: | + source .venv/bin/activate + tox -e py38 + + - save_cache: + key: 'tox-3.8-{{ checksum "tox.ini" }}-{{ checksum "setup.py" }}' + paths: + - .tox + + - store_test_results: + path: .tox/py38/artifacts/ + +workflows: + version: 2 + test: + jobs: + - build-3.7 + - build-3.8 diff --git a/.gitignore b/.gitignore index 2e41686..f644f52 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ **/__pycache__/** *.egg-info .coverage -.python-version .tox/ .venv/ build/ diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..b7e92d4 --- /dev/null +++ b/.python-version @@ -0,0 +1,2 @@ +3.7.5 +3.8.0 diff --git a/aioredis_lock/locks.py b/aioredis_lock/locks.py index 0bc0c1d..a76709d 100644 --- a/aioredis_lock/locks.py +++ b/aioredis_lock/locks.py @@ -18,7 +18,7 @@ def token_factory() -> str: return str(uuid.uuid4()) -@dataclasses.dataclass +@dataclasses.dataclass # pylint: disable=too-many-instance-attributes class RedisLock: """ Implementation of distributed locking with aioredis. diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..5496d46 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +junit_family=legacy diff --git a/setup.py b/setup.py index 0cbd21b..f37c9d3 100644 --- a/setup.py +++ b/setup.py @@ -27,6 +27,7 @@ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", "Programming Language :: Python :: Implementation :: CPython", ], keywords=["aioredis", "redis", "locking", "distributed", "asyncio"], diff --git a/tests/test_locks.py b/tests/test_locks.py index 2a1057c..098d726 100644 --- a/tests/test_locks.py +++ b/tests/test_locks.py @@ -16,7 +16,7 @@ def redis_server(): @pytest.fixture async def redis_pool(event_loop): - pool = await aioredis.create_redis_pool("redis://127.0.0.1:6380/0", loop=event_loop) + pool = await aioredis.create_redis_pool("redis://127.0.0.1:6380/0") yield pool pool.close() await pool.wait_closed() @@ -24,7 +24,7 @@ async def redis_pool(event_loop): @pytest.fixture async def redis_connection(event_loop): - conn = await aioredis.create_redis("redis://127.0.0.1:6380/1", loop=event_loop) + conn = await aioredis.create_redis("redis://127.0.0.1:6380/1") yield conn conn.close() await conn.wait_closed() diff --git a/tox.ini b/tox.ini index cc0e627..3127c1c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,6 @@ [tox] -envlist = py37, lint, fmt +envlist = py37, py38, lint, fmt +skip_missing_interpreters = true [testenv] deps =