Skip to content

Commit

Permalink
Merge bc788bb into 2d267e7
Browse files Browse the repository at this point in the history
  • Loading branch information
bmerry committed Sep 6, 2021
2 parents 2d267e7 + bc788bb commit fa4ef58
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- run: pip install .
if: ${{ matrix.coverage != 'yes' }}
- run: flake8
- run: pytest --cov=fakeredis --cov-branch
- run: pytest -v --cov=fakeredis --cov-branch
if: ${{ matrix.coverage == 'yes' }}
- run: pytest
if: ${{ matrix.coverage != 'yes' }}
Expand Down
1 change: 0 additions & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
aioredis
async_generator
coverage
flake8
hypothesis
Expand Down
16 changes: 7 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#
# This file is autogenerated by pip-compile
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
#
# pip-compile requirements.in
#
aioredis==1.3.1
# via -r requirements.in
async-generator==1.10
# via -r requirements.in
async-timeout==3.0.1
# via aioredis
attrs==20.3.0
Expand Down Expand Up @@ -42,18 +40,18 @@ pyflakes==2.2.0
# via flake8
pyparsing==2.4.7
# via packaging
pytest-asyncio==0.14.0
# via -r requirements.in
pytest-cov==2.10.1
# via -r requirements.in
pytest-mock==3.3.1
# via -r requirements.in
pytest==6.1.2
# via
# -r requirements.in
# pytest-asyncio
# pytest-cov
# pytest-mock
pytest-asyncio==0.15.1
# via -r requirements.in
pytest-cov==2.10.1
# via -r requirements.in
pytest-mock==3.3.1
# via -r requirements.in
redis==3.5.3
# via -r requirements.in
six==1.15.0
Expand Down
7 changes: 2 additions & 5 deletions test/test_aioredis1.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from packaging.version import Version
import pytest
import aioredis
from async_generator import yield_, async_generator

import fakeredis.aioredis

Expand All @@ -21,7 +20,6 @@
pytest.param('real', marks=pytest.mark.real)
]
)
@async_generator
async def r(request):
if request.param == 'fake':
ret = await fakeredis.aioredis.create_redis_pool()
Expand All @@ -31,19 +29,18 @@ async def r(request):
ret = await aioredis.create_redis_pool('redis://localhost')
await ret.flushall()

await yield_(ret)
yield ret

await ret.flushall()
ret.close()
await ret.wait_closed()


@pytest.fixture
@async_generator
async def conn(r):
"""A single connection, rather than a pool."""
with await r as conn:
await yield_(conn)
yield conn


async def test_ping(r):
Expand Down
7 changes: 2 additions & 5 deletions test/test_aioredis2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pytest
import aioredis
import async_timeout
from async_generator import yield_, async_generator

import fakeredis.aioredis

Expand All @@ -28,7 +27,6 @@
pytest.param('real', marks=pytest.mark.real)
]
)
@async_generator
async def r(request):
if request.param == 'fake':
fake_server = request.getfixturevalue('fake_server')
Expand All @@ -41,19 +39,18 @@ async def r(request):
if not fake_server or fake_server.connected:
await ret.flushall()

await yield_(ret)
yield ret

if not fake_server or fake_server.connected:
await ret.flushall()
await ret.connection_pool.disconnect()


@pytest.fixture
@async_generator
async def conn(r):
"""A single connection, rather than a pool."""
async with r.client() as conn:
await yield_(conn)
yield conn


async def test_ping(r):
Expand Down

0 comments on commit fa4ef58

Please sign in to comment.