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

Commit

Permalink
Merge pull request #1219 from m-novikov/m-novikov-pytest-markers
Browse files Browse the repository at this point in the history
Add test markers to allow more granularity selecting tests
  • Loading branch information
seandstewart committed Feb 4, 2022
2 parents f2463c3 + f147e1a commit 8a38f98
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
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 @@ -136,27 +136,39 @@ def skip_unless_arch_bits(arch_bits: int) -> _TestDecorator:

@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

0 comments on commit 8a38f98

Please sign in to comment.