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

Commit f147e1a

Browse files
committed
Add test markers to allow more granularity selecting tests
To speed up testing add markers for selecting/deselecting following cases: * hiredis_parser * python_parser * connection pool * single connection
1 parent 2ba15fb commit f147e1a

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
@@ -132,27 +132,39 @@ def skip_unless_arch_bits(arch_bits):
132132

133133
@pytest.fixture(
134134
params=[
135-
(True, PythonParser),
136-
(False, PythonParser),
135+
pytest.param(
136+
(True, PythonParser),
137+
marks=[pytest.mark.python_parser, pytest.mark.single_connection],
138+
id="single-connection-python-parser",
139+
),
140+
pytest.param(
141+
(False, PythonParser),
142+
marks=[pytest.mark.python_parser, pytest.mark.connection_pool],
143+
id="pool-python-parser",
144+
),
137145
pytest.param(
138146
(True, HiredisParser),
139-
marks=pytest.mark.skipif(
140-
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
141-
),
147+
marks=[
148+
pytest.mark.skipif(
149+
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
150+
),
151+
pytest.mark.hiredis_parser,
152+
pytest.mark.single_connection,
153+
],
154+
id="single-connection-hiredis",
142155
),
143156
pytest.param(
144157
(False, HiredisParser),
145-
marks=pytest.mark.skipif(
146-
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
147-
),
158+
marks=[
159+
pytest.mark.skipif(
160+
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
161+
),
162+
pytest.mark.hiredis_parser,
163+
pytest.mark.connection_pool,
164+
],
165+
id="pool-hiredis",
148166
),
149167
],
150-
ids=[
151-
"single-python-parser",
152-
"pool-python-parser",
153-
"single-hiredis",
154-
"pool-hiredis",
155-
],
156168
)
157169
def create_redis(request, event_loop):
158170
"""Wrapper around aioredis.create_redis."""

0 commit comments

Comments
 (0)