Skip to content

Commit 44c7706

Browse files
committed
Update type hints in tests.
1 parent c9f48d4 commit 44c7706

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed

tests/test_integration.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
@pytest.fixture()
7-
def requirements(tmp_pathplus):
7+
def requirements(tmp_pathplus: PathPlus) -> None:
88
fake_repo_root = tmp_pathplus.parent
99

1010
(fake_repo_root / "requirements.txt").write_text("""\
@@ -16,7 +16,8 @@ def requirements(tmp_pathplus):
1616
""")
1717

1818

19-
def test_integration(requirements, the_app):
19+
@pytest.mark.usefixtures("requirements")
20+
def test_integration(the_app):
2021
# app is a Sphinx application object for default sphinx project (`tests/doc-test/test-root`).
2122
the_app.build()
2223

tests/test_requirements_parsers.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
# stdlib
2+
from typing import List
3+
14
# 3rd party
25
import pytest
36
import toml
7+
from domdf_python_tools.paths import PathPlus
48

59
# this package
610
from seed_intersphinx_mapping.requirements_parsers import (
@@ -52,7 +56,11 @@
5256
(bad_example_requirements, bad_expected_requirements),
5357
]
5458
)
55-
def test_parse_requirements_txt(tmp_pathplus, contents, expects):
59+
def test_parse_requirements_txt(
60+
tmp_pathplus: PathPlus,
61+
contents: str,
62+
expects: List[str],
63+
):
5664
(tmp_pathplus / "requirements.txt").write_text(contents)
5765

5866
assert parse_requirements_txt(tmp_pathplus) == expects
@@ -64,7 +72,11 @@ def test_parse_requirements_txt(tmp_pathplus, contents, expects):
6472
(bad_example_requirements, bad_expected_requirements),
6573
]
6674
)
67-
def test_seed_intersphinx_mapping_pyproject(tmp_pathplus, contents, expects):
75+
def test_seed_intersphinx_mapping_pyproject(
76+
tmp_pathplus: PathPlus,
77+
contents: str,
78+
expects: List[str],
79+
):
6880
data = {"project": {"dependencies": contents.splitlines()}}
6981
(tmp_pathplus / "pyproject.toml").write_clean(toml.dumps(data))
7082

@@ -77,7 +89,11 @@ def test_seed_intersphinx_mapping_pyproject(tmp_pathplus, contents, expects):
7789
(bad_example_requirements, bad_expected_requirements),
7890
]
7991
)
80-
def test_seed_intersphinx_mapping_flit(tmp_pathplus, contents, expects):
92+
def test_seed_intersphinx_mapping_flit(
93+
tmp_pathplus: PathPlus,
94+
contents: str,
95+
expects: List[str],
96+
):
8197
data = {"tool": {"flit": {"metadata": {"requires": contents.splitlines()}}}}
8298
(tmp_pathplus / "pyproject.toml").write_clean(toml.dumps(data))
8399

tests/test_seeding.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# stdlib
22
from types import SimpleNamespace
3+
from typing import List
34

45
# 3rd party
56
import pytest
67
import toml
78
from coincidence import AdvancedDataRegressionFixture
9+
from domdf_python_tools.paths import PathPlus
810
from shippinglabel.requirements import read_requirements
911

1012
# this package
@@ -38,7 +40,12 @@
3840
(bad_example_requirements, bad_expected_mapping),
3941
]
4042
)
41-
def test_seed_intersphinx_mapping(tmp_pathplus, contents, expects, capsys):
43+
def test_seed_intersphinx_mapping(
44+
tmp_pathplus: PathPlus,
45+
contents: str,
46+
expects: List[str],
47+
capsys,
48+
):
4249
(tmp_pathplus / "requirements.txt").write_text(contents)
4350

4451
assert seed_intersphinx_mapping(*parse_requirements_txt(tmp_pathplus)) == expects
@@ -57,7 +64,7 @@ def test_seed_intersphinx_mapping(tmp_pathplus, contents, expects, capsys):
5764
(bad_example_requirements, bad_expected_mapping),
5865
]
5966
)
60-
def test_seed_intersphinx_mapping_pyproject(tmp_pathplus, contents, expects, capsys):
67+
def test_seed_intersphinx_mapping_pyproject(tmp_pathplus: PathPlus, contents: str, expects: List[str], capsys):
6168
data = {"project": {"dependencies": contents.splitlines()}}
6269
(tmp_pathplus / "pyproject.toml").write_clean(toml.dumps(data))
6370

@@ -72,7 +79,7 @@ def test_seed_intersphinx_mapping_pyproject(tmp_pathplus, contents, expects, cap
7279
(bad_example_requirements, bad_expected_mapping),
7380
]
7481
)
75-
def test_seed_intersphinx_mapping_flit(tmp_pathplus, contents, expects, capsys):
82+
def test_seed_intersphinx_mapping_flit(tmp_pathplus: PathPlus, contents: str, expects: List[str], capsys):
7683
data = {"tool": {"flit": {"metadata": {"requires": contents.splitlines()}}}}
7784
(tmp_pathplus / "pyproject.toml").write_clean(toml.dumps(data))
7885

@@ -90,9 +97,9 @@ def test_seed_intersphinx_mapping_flit(tmp_pathplus, contents, expects, capsys):
9097
]
9198
)
9299
def test_sphinx_seed_intersphinx_mapping_mocked(
93-
tmp_pathplus,
100+
tmp_pathplus: PathPlus,
94101
capsys,
95-
contents,
102+
contents: str,
96103
advanced_data_regression: AdvancedDataRegressionFixture,
97104
pkg_requirements_source: str
98105
):
@@ -122,7 +129,7 @@ def test_sphinx_seed_intersphinx_mapping_mocked(
122129

123130

124131
def test_sphinx_seed_intersphinx_mapping_list_mocked(
125-
tmp_pathplus,
132+
tmp_pathplus: PathPlus,
126133
advanced_data_regression: AdvancedDataRegressionFixture,
127134
):
128135

0 commit comments

Comments
 (0)