Skip to content

Commit a9aa3d3

Browse files
test: Use native Pytest 9+ support for subtests
1 parent 0c2dd10 commit a9aa3d3

File tree

4 files changed

+14
-36
lines changed

4 files changed

+14
-36
lines changed

docs/how-to.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For the full JSON-RPC reference, see the [RemoteControl 2 API docs][rc2api].
99
:end-before: end example
1010
```
1111

12-
Otherwise, you can manually close the session with {meth}`client.close() <citric.client.Client.close>`.
12+
Otherwise, you can manually close the session with {meth}`client.close() <citric.Client.close>`.
1313

1414
## Get surveys and questions
1515

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ test = [
6868
"pytest-github-actions-annotate-failures>=0.1.7",
6969
"pytest-httpserver>=1.0.8",
7070
"pytest-randomly>=3.15",
71-
"pytest-subtests>=0.11",
7271
"python-dotenv>=1",
7372
"semver>=3.0.1",
7473
"tinydb>=4.8",
@@ -248,7 +247,7 @@ DEP004 = [
248247
[tool.pyproject-fmt]
249248
max_supported_python = "3.15"
250249

251-
[tool.pytest.ini_options]
250+
[tool.pytest]
252251
addopts = [
253252
"--durations=5",
254253
"-ra", # show extra test summary info for all except passed
@@ -264,7 +263,7 @@ markers = [
264263
"integration_test: Integration and end-to-end tests",
265264
"xfail_mysql: Mark a test as expected to fail on MySQL",
266265
]
267-
minversion = "8"
266+
minversion = "9.0.0"
268267
testpaths = [
269268
"tests",
270269
]

tests/integration/test_rpc_client.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
if TYPE_CHECKING:
2727
from faker import Faker
28-
from pytest_subtests import SubTests
2928

3029
from citric.types import QuestionsListElement
3130
from tests.fixtures import MailpitClient
@@ -65,7 +64,7 @@ def participants(faker: Faker) -> list[dict[str, Any]]:
6564

6665

6766
@pytest.mark.integration_test
68-
def test_fieldmap(client: citric.Client, survey_id: int, subtests: SubTests):
67+
def test_fieldmap(client: citric.Client, survey_id: int, subtests: pytest.Subtests):
6968
"""Test fieldmap."""
7069
fieldmap = client.get_fieldmap(survey_id)
7170
for key, value in fieldmap.items():
@@ -79,7 +78,7 @@ def test_fieldmap(client: citric.Client, survey_id: int, subtests: SubTests):
7978

8079

8180
@pytest.mark.integration_test
82-
def test_language(client: citric.Client, survey_id: int, subtests: SubTests):
81+
def test_language(client: citric.Client, survey_id: int, subtests: pytest.Subtests):
8382
"""Test language methods."""
8483
# Add a new language
8584
assert client.add_language(survey_id, "es")["status"] == "OK"
@@ -125,7 +124,7 @@ def test_language(client: citric.Client, survey_id: int, subtests: SubTests):
125124
def test_survey(
126125
client: citric.Client,
127126
server_version: semver.VersionInfo,
128-
subtests: SubTests,
127+
subtests: pytest.Subtests,
129128
):
130129
"""Test survey methods."""
131130
# Try to get a survey that doesn't exist
@@ -179,7 +178,7 @@ def test_survey(
179178

180179

181180
@pytest.mark.integration_test
182-
def test_import_survey(client: citric.Client, subtests: SubTests):
181+
def test_import_survey(client: citric.Client, subtests: pytest.Subtests):
183182
"""Test importing a survey with a custom ID and name."""
184183
survey_id = random.randint(10000, 20000) # noqa: S311
185184
with Path("./examples/survey.lss").open("rb") as f:
@@ -417,7 +416,7 @@ def test_quota(
417416
client: citric.Client,
418417
server_version: semver.VersionInfo,
419418
survey_id: int,
420-
subtests: SubTests,
419+
subtests: pytest.Subtests,
421420
):
422421
"""Test quota methods."""
423422
request.applymarker(
@@ -623,7 +622,7 @@ def test_participants(
623622
client: citric.Client,
624623
survey_id: int,
625624
participants: list[dict[str, str]],
626-
subtests: SubTests,
625+
subtests: pytest.Subtests,
627626
):
628627
"""Test participants methods."""
629628
client.activate_survey(survey_id)
@@ -762,7 +761,7 @@ def test_responses(
762761
survey_id: int,
763762
responses: list[dict],
764763
tmp_path: Path,
765-
subtests: SubTests,
764+
subtests: pytest.Subtests,
766765
):
767766
"""Test adding and exporting responses."""
768767
client.activate_survey(survey_id)
@@ -872,7 +871,7 @@ def test_summary(
872871
survey_id: int,
873872
participants: list[dict],
874873
responses: list[dict],
875-
subtests: SubTests,
874+
subtests: pytest.Subtests,
876875
):
877876
"""Test get_summary client method."""
878877
with (
@@ -1202,7 +1201,7 @@ def test_mail_registered_participants(
12021201
survey_id: int,
12031202
participants: list[dict[str, str]],
12041203
mailpit: MailpitClient,
1205-
subtests: SubTests,
1204+
subtests: pytest.Subtests,
12061205
):
12071206
"""Test mail_registered_participants."""
12081207
client.activate_survey(survey_id)
@@ -1246,7 +1245,7 @@ def test_remind_participants(
12461245
survey_id: int,
12471246
participants: list[dict[str, str]],
12481247
mailpit: MailpitClient,
1249-
subtests: SubTests,
1248+
subtests: pytest.Subtests,
12501249
):
12511250
"""Test remind_participants."""
12521251
client.activate_survey(survey_id)

uv.lock

Lines changed: 1 addition & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)