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

Add test markers to allow more granularity selecting tests #1219

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/1219.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add pytest markers for parsers and connection types
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ issue_format = "#{issue}"
underlines = ["", ""]
template = ".towncrier.md.jinja"
title_format = "## {version} - ({project_date})"

[tool.pytest.ini_options]
markers = [
"hiredis_parser: mark a test as using hiredis parser",
"python_parser: mark a test as using python parser",
"connection_pool: mark a test as using connection_pool client",
"single_connection: mark a test as using single connection client",
]
40 changes: 26 additions & 14 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,27 +132,39 @@ def skip_unless_arch_bits(arch_bits):

@pytest.fixture(
params=[
(True, PythonParser),
(False, PythonParser),
pytest.param(
(True, PythonParser),
marks=[pytest.mark.python_parser, pytest.mark.single_connection],
id="single-connection-python-parser",
),
pytest.param(
(False, PythonParser),
marks=[pytest.mark.python_parser, pytest.mark.connection_pool],
id="pool-python-parser",
),
pytest.param(
(True, HiredisParser),
marks=pytest.mark.skipif(
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
),
marks=[
pytest.mark.skipif(
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
),
pytest.mark.hiredis_parser,
pytest.mark.single_connection,
],
id="single-connection-hiredis",
),
pytest.param(
(False, HiredisParser),
marks=pytest.mark.skipif(
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
),
marks=[
pytest.mark.skipif(
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
),
pytest.mark.hiredis_parser,
pytest.mark.connection_pool,
],
id="pool-hiredis",
),
],
ids=[
"single-python-parser",
"pool-python-parser",
"single-hiredis",
"pool-hiredis",
],
)
def create_redis(request, event_loop):
"""Wrapper around aioredis.create_redis."""
Expand Down