Skip to content

Commit

Permalink
update markers
Browse files Browse the repository at this point in the history
  • Loading branch information
popravich committed Nov 16, 2017
1 parent 137d0f3 commit 433da00
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 35 deletions.
61 changes: 34 additions & 27 deletions benchmark/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@


@pytest.fixture(scope='session', params=[
pytest.param(HiredisParser, marks=pytest.mark.hiredis, id='redis-py[hi]'),
pytest.param(PythonParser, marks=pytest.mark.pyreader, id='redis-py[py]'),
pytest.param(HiredisParser,
marks=[pytest.mark.hiredis, pytest.mark.redispy],
id='redis-py[hi]'),
pytest.param(PythonParser,
marks=[pytest.mark.pyreader, pytest.mark.redispy],
id='redis-py[py]'),
])
def redispy(request):
pool = redis.ConnectionPool(parser_class=request.param)
Expand Down Expand Up @@ -66,29 +70,32 @@ class HiredisParserReader(PythonParserReader):


@pytest.fixture(params=[
pytest.param(HiReader(), marks=pytest.mark.hiredis,
id='hiredis'),
pytest.param(HiReader(encoding='utf-8'), marks=pytest.mark.hiredis,
id='hiredis(utf-8)'),
pytest.param(PyReader(), marks=pytest.mark.pyreader,
id='aioredis-python'),
pytest.param(PyReader(encoding='utf-8'), marks=pytest.mark.pyreader,
id='aioredis-python(utf-8)'),
pytest.param(PythonParserReader(), marks=pytest.mark.pyreader,
id='redispy-python'),
pytest.param(PythonParserReader(encoding='utf-8'),
marks=pytest.mark.pyreader,
id='redispy-python(utf-8)'),
pytest.param(HiredisParserReader(), marks=pytest.mark.hiredis,
id='redispy-hiredis'),
pytest.param(HiredisParserReader(encoding='utf-8'),
marks=pytest.mark.hiredis,
id='redispy-hiredis(utf-8)'),
pytest.param(None, id='bytes'),
pytest.param('utf-8', id='utf-8'),
])
def reader(request):
def reader_encoding(request):
return request.param


@pytest.fixture(params=[
pytest.param(HiReader, marks=pytest.mark.hiredis,
id='hiredis'),
pytest.param(PyReader,
marks=[pytest.mark.pyreader, pytest.mark.aioredis],
id='aioredis[py]'),
pytest.param(PythonParserReader,
marks=[pytest.mark.pyreader, pytest.mark.redispy],
id='redispy[py]'),
pytest.param(HiredisParserReader,
marks=[pytest.mark.hiredis, pytest.mark.redispy],
id='redispy[hi]'),
])
def reader(request, reader_encoding):
if reader_encoding:
return request.param(encoding=reader_encoding)
return request.param()


async def aredis_start():
client = aredis.StrictRedis.from_url(
'redis://localhost:6379',
Expand Down Expand Up @@ -149,22 +156,22 @@ async def asyncio_redis_stop(pool):

@pytest.fixture(params=[
pytest.param((aredis_start, None),
marks=pytest.mark.hiredis,
marks=[pytest.mark.hiredis, pytest.mark.aredis],
id='aredis[hi]-------'),
pytest.param((aredis_py_start, None),
marks=pytest.mark.pyreader,
marks=[pytest.mark.pyreader, pytest.mark.aredis],
id='aredis[py]-------'),
pytest.param((aioredis_start, aioredis_stop),
marks=pytest.mark.hiredis,
marks=[pytest.mark.hiredis, pytest.mark.aioredis],
id='aioredis[hi]-----'),
pytest.param((aioredis_py_start, aioredis_stop),
marks=pytest.mark.pyreader,
marks=[pytest.mark.pyreader, pytest.mark.aioredis],
id='aioredis[py]-----'),
pytest.param((asyncio_redis_start, asyncio_redis_stop),
marks=pytest.mark.hiredis,
marks=[pytest.mark.hiredis, pytest.mark.asyncio_redis],
id='asyncio_redis[hi]'),
pytest.param((asyncio_redis_py_start, asyncio_redis_stop),
marks=pytest.mark.pyreader,
marks=[pytest.mark.pyreader, pytest.mark.asyncio_redis],
id='asyncio_redis[py]'),
])
def async_redis(loop, request):
Expand Down
2 changes: 1 addition & 1 deletion benchmark/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def benchmark_parser_simple_string(benchmark, reader):
@pytest.mark.simple_error
@pytest.mark.benchmark(group='simple-error')
def benchmark_parser_simple_error(benchmark, reader):
benchmark(feed_and_gets, reader, b'-Error\r\n')
benchmark(feed_and_gets, reader, b'-ERR invalid password\r\n')


@pytest.mark.bulk_string_1k
Expand Down
13 changes: 6 additions & 7 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ python_functions = benchmark_*
markers =
pyreader: Mark the test function (parameter) as one testing python parser.
hiredis: Mark the test function (parameter) as one testing hiredis parser.
simple_string: Simple string redis replies.
simple_error: Simple error redis replies.
bulk_string_1k: Bulk string (1 Kbytes) redis replies.
bulk_string_4k: Bulk string (4 Kbytes) redis replies.
bulk_string_16k: Bulk string (16 Kbytes) redis replies.
bulk_string_32k: Bulk string (32 Kbytes) redis replies.
multi_bulk: Multi bulk redis replies.
aioredis: Marker for aioredis tests.
aredis: Marker for aredis tests.
asyncio_redis: Marker for asyncio_redis tests.
redispy: Marker for redis-py tests.
uvloop: Run tests with uvloop.
asyncio: Run tests with asyncio.

0 comments on commit 433da00

Please sign in to comment.