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

Commit

Permalink
Add test markers to allow more granularity selecting tests
Browse files Browse the repository at this point in the history
To speed up testing add markers for selecting/deselecting following cases:
* hiredis_parser
* python_parser
* connection pool
* single connection
  • Loading branch information
m-novikov committed Nov 22, 2021
1 parent 2ba15fb commit f147e1a
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 @@ -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

0 comments on commit f147e1a

Please sign in to comment.