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

Commit

Permalink
Some modernisation
Browse files Browse the repository at this point in the history
- Get rid of all python_version>="3.5" in requirements
- Get rid of async_generator
- Update dependencies to latest versions
- Pin aioredis<2 (since aioredis 2 has a totally different API)
  • Loading branch information
bmerry committed Sep 2, 2021
1 parent 760a282 commit f3fefd5
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 57 deletions.
13 changes: 4 additions & 9 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
aioredis<2
coverage
coveralls
cffi
redis
pytest
pytest-asyncio
pytest-cov
flake8
coverage
coveralls

aioredis; python_version>="3.5"
pytest-asyncio; python_version>="3.5"
async-generator; python_version>="3.5"
# The following are not direct requirements, but are added because pip-compile
# doesn't propagate environment markers to dependencies.
async-timeout; python_version>="3.5"
59 changes: 26 additions & 33 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,74 +4,67 @@
#
# pip-compile requirements.in
#
aioredis==1.3.0 ; python_version >= "3.5"
aioredis==1.3.1
# via -r requirements.in
async-generator==1.10 ; python_version >= "3.5"
# via -r requirements.in
async-timeout==3.0.1 ; python_version >= "3.5"
# via
# -r requirements.in
# aioredis
atomicwrites==1.3.0
# via pytest
attrs==19.1.0
async-timeout==3.0.1
# via aioredis
attrs==21.2.0
# via pytest
certifi==2019.3.9
certifi==2021.5.30
# via requests
cffi==1.12.3
cffi==1.14.6
# via -r requirements.in
charset-normalizer==2.0.4
# via requests
coverage==4.5.3
coverage==5.5
# via
# -r requirements.in
# coveralls
# pytest-cov
coveralls==1.7.0
coveralls==3.2.0
# via -r requirements.in
docopt==0.6.2
# via coveralls
entrypoints==0.3
# via flake8
flake8==3.7.7
flake8==3.9.2
# via -r requirements.in
hiredis==1.0.0
hiredis==2.0.0
# via aioredis
idna==2.8
idna==3.2
# via requests
iniconfig==1.1.1
# via pytest
mccabe==0.6.1
# via flake8
more-itertools==5.0.0
packaging==21.0
# via pytest
pluggy==0.9.0
pluggy==1.0.0
# via pytest
py==1.10.0
# via pytest
pycodestyle==2.5.0
pycodestyle==2.7.0
# via flake8
pycparser==2.19
pycparser==2.20
# via cffi
pyflakes==2.1.1
pyflakes==2.3.1
# via flake8
pytest==4.4.1
pyparsing==2.4.7
# via packaging
pytest==6.2.5
# via
# -r requirements.in
# pytest-asyncio
# pytest-cov
pytest-asyncio==0.10.0 ; python_version >= "3.5"
pytest-asyncio==0.15.1
# via -r requirements.in
pytest-cov==2.6.1
pytest-cov==2.12.1
# via -r requirements.in
redis==3.2.1
redis==3.5.3
# via -r requirements.in
requests==2.26.0
# via coveralls
six==1.12.0
toml==0.10.2
# via
# more-itertools
# pytest
# pytest-cov
urllib3==1.26.6
# via requests

# The following packages are considered to be unsafe in a requirements file:
# setuptools
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@

tests_require = [
'pytest', 'pytest-forked', 'redis',
'pytest-asyncio; python_version >= "3.5"',
'async-generator; python_version >= "3.5"',
'aioredis; python_version >= "3.5"'
'pytest-asyncio',
'aioredis'
]

setup(
Expand Down Expand Up @@ -47,7 +46,7 @@
install_requires=['cffi>=1.0.0'],
extras_require={
'redis': 'redis',
'aioredis': 'aioredis',
'aioredis': 'aioredis<2',
'test': tests_require
},
tests_require=tests_require,
Expand Down
16 changes: 5 additions & 11 deletions tests/test_aioredis.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,44 @@
from async_generator import yield_, async_generator
import pytest
import aioredis

import birdisle.aioredis


@pytest.fixture
@async_generator
async def server():
server = birdisle.Server()
await yield_(server)
yield server
server.close()


@pytest.fixture
@async_generator
async def conn(server):
conn = await birdisle.aioredis.create_connection(server)
await yield_(conn)
yield conn
conn.close()
await conn.wait_closed()


@pytest.fixture
@async_generator
async def pool(server):
pool = await birdisle.aioredis.create_pool(server)
await yield_(pool)
yield pool
pool.close()
await pool.wait_closed()


@pytest.fixture
@async_generator
async def r(server):
redis = await birdisle.aioredis.create_redis(server)
await yield_(redis)
yield redis
redis.close()
await redis.wait_closed()


@pytest.fixture
@async_generator
async def redis_pool(server):
pool = await birdisle.aioredis.create_redis_pool(server)
await yield_(pool)
yield pool
pool.close()
await pool.wait_closed()

Expand Down

0 comments on commit f3fefd5

Please sign in to comment.