Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
Testing updates (#7)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mattrasband authored Dec 10, 2019
1 parent 811e5fd commit 36b385b
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 7 deletions.
47 changes: 45 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2

jobs:
build:
build-3.7: &build
parallelism: 1
working_directory: ~/app
docker:
Expand All @@ -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" }}'
Expand All @@ -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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
**/__pycache__/**
*.egg-info
.coverage
.python-version
.tox/
.venv/
build/
Expand Down
2 changes: 2 additions & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
3.7.5
3.8.0
2 changes: 1 addition & 1 deletion aioredis_lock/locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
junit_family=legacy
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
4 changes: 2 additions & 2 deletions tests/test_locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ 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()


@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()
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[tox]
envlist = py37, lint, fmt
envlist = py37, py38, lint, fmt
skip_missing_interpreters = true

[testenv]
deps =
Expand Down

0 comments on commit 36b385b

Please sign in to comment.