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

Commit 8a38f98

Browse files
authored
Merge pull request #1219 from m-novikov/m-novikov-pytest-markers
Add test markers to allow more granularity selecting tests
2 parents f2463c3 + f147e1a commit 8a38f98

File tree

3 files changed

+35
-14
lines changed

3 files changed

+35
-14
lines changed

CHANGES/1219.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add pytest markers for parsers and connection types

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@ issue_format = "#{issue}"
77
underlines = ["", ""]
88
template = ".towncrier.md.jinja"
99
title_format = "## {version} - ({project_date})"
10+
11+
[tool.pytest.ini_options]
12+
markers = [
13+
"hiredis_parser: mark a test as using hiredis parser",
14+
"python_parser: mark a test as using python parser",
15+
"connection_pool: mark a test as using connection_pool client",
16+
"single_connection: mark a test as using single connection client",
17+
]

tests/conftest.py

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -136,27 +136,39 @@ def skip_unless_arch_bits(arch_bits: int) -> _TestDecorator:
136136

137137
@pytest.fixture(
138138
params=[
139-
(True, PythonParser),
140-
(False, PythonParser),
139+
pytest.param(
140+
(True, PythonParser),
141+
marks=[pytest.mark.python_parser, pytest.mark.single_connection],
142+
id="single-connection-python-parser",
143+
),
144+
pytest.param(
145+
(False, PythonParser),
146+
marks=[pytest.mark.python_parser, pytest.mark.connection_pool],
147+
id="pool-python-parser",
148+
),
141149
pytest.param(
142150
(True, HiredisParser),
143-
marks=pytest.mark.skipif(
144-
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
145-
),
151+
marks=[
152+
pytest.mark.skipif(
153+
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
154+
),
155+
pytest.mark.hiredis_parser,
156+
pytest.mark.single_connection,
157+
],
158+
id="single-connection-hiredis",
146159
),
147160
pytest.param(
148161
(False, HiredisParser),
149-
marks=pytest.mark.skipif(
150-
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
151-
),
162+
marks=[
163+
pytest.mark.skipif(
164+
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
165+
),
166+
pytest.mark.hiredis_parser,
167+
pytest.mark.connection_pool,
168+
],
169+
id="pool-hiredis",
152170
),
153171
],
154-
ids=[
155-
"single-python-parser",
156-
"pool-python-parser",
157-
"single-hiredis",
158-
"pool-hiredis",
159-
],
160172
)
161173
def create_redis(request, event_loop):
162174
"""Wrapper around aioredis.create_redis."""

0 commit comments

Comments
 (0)