Skip to content

Commit 9ca8055

Browse files
committed
Cleanup docstrings
1 parent 27ba531 commit 9ca8055

File tree

3 files changed

+39
-11
lines changed

3 files changed

+39
-11
lines changed

tests/test_argparser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_no_option_string(
1515
"""Test an argument without an option string.
1616
1717
Args:
18-
capsys (pytest.CaptureFixture[str]): Pytest fixture.
18+
capsys: Pytest fixture.
1919
"""
2020
parser = ArgumentParser(
2121
formatter_class=CustomHelpFormatter,
@@ -36,7 +36,7 @@ def test_one_string(
3636
"""Test an argument without an option string.
3737
3838
Args:
39-
capsys (pytest.CaptureFixture[str]): Pytest fixture.
39+
capsys: Pytest fixture.
4040
"""
4141
parser = ArgumentParser(
4242
formatter_class=CustomHelpFormatter,
@@ -58,7 +58,7 @@ def test_too_many_string(
5858
"""Test an argument with too many option strings.
5959
6060
Args:
61-
monkeypatch (pytest.MonkeyPatch): Pytest fixture.
61+
monkeypatch: Pytest fixture.
6262
"""
6363
monkeypatch.setattr("sys.argv", ["prog", "--help"])
6464

@@ -80,7 +80,7 @@ def test_group_no_title(capsys: pytest.CaptureFixture[str]) -> None:
8080
"""Test a group without a title.
8181
8282
Args:
83-
capsys (pytest.CaptureFixture[str]): Pytest fixture.
83+
capsys: Pytest fixture.
8484
"""
8585
parser = ArgumentParser(
8686
formatter_class=CustomHelpFormatter,

tests/unit/test_cli.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def main(cli: Cli) -> None:
1212
"""Stub main function for testing.
1313
1414
Args:
15-
cli (Cli): Cli object.
15+
cli: Cli object.
1616
"""
1717
cli.parse_args()
1818
cli.init_output()
@@ -24,7 +24,7 @@ def test_cpi(monkeypatch: pytest.MonkeyPatch) -> None:
2424
"""Test the cpi option.
2525
2626
Args:
27-
monkeypatch (pytest.MonkeyPatch): Pytest fixture.
27+
monkeypatch: Pytest fixture.
2828
"""
2929
monkeypatch.setattr("sys.argv", ["ansible-dev-environment", "install", "--cpi"])
3030
cli = Cli()
@@ -40,7 +40,7 @@ def test_tty(monkeypatch: pytest.MonkeyPatch) -> None:
4040
"""Test term features with tty.
4141
4242
Args:
43-
monkeypatch (pytest.MonkeyPatch): Pytest fixture.
43+
monkeypatch: Pytest fixture.
4444
"""
4545
monkeypatch.setattr("sys.stdout.isatty", (lambda: True))
4646
monkeypatch.setattr("os.environ", {"NO_COLOR": ""})
@@ -85,7 +85,8 @@ def test_editable_many(
8585
"""Test the editable option with too many arguments.
8686
8787
Args:
88-
monkeypatch (pytest.MonkeyPatch): Pytest fixture.
88+
capsys: Pytest stdout capture fixture.
89+
monkeypatch: Pytest fixture.
8990
"""
9091
monkeypatch.setattr(
9192
"sys.argv",
@@ -142,6 +143,7 @@ def test_acp_env_var_set(
142143
"""Test the ansible collection path environment variable set.
143144
144145
Args:
146+
env_var: Environment variable name.
145147
capsys: Pytest stdout capture fixture.
146148
monkeypatch: Pytest fixture.
147149
"""
@@ -198,7 +200,13 @@ def test_collections_in_user(
198200
exists = Path.exists
199201

200202
def _exists(self: Path) -> bool:
201-
"""Patch the exists method."""
203+
"""Patch the exists method.
204+
205+
Args:
206+
self: Path object.
207+
Returns:
208+
bool: True if the path exists.
209+
"""
202210
if self == usr_path:
203211
return True
204212
return exists(self)
@@ -208,7 +216,13 @@ def _exists(self: Path) -> bool:
208216
iterdir = Path.iterdir
209217

210218
def _iterdir(self: Path) -> list[Path] | Generator[Path, None, None]:
211-
"""Patch the iterdir method."""
219+
"""Patch the iterdir method.
220+
221+
Args:
222+
self: Path object.
223+
Returns:
224+
List of paths or generator.
225+
"""
212226
if self == usr_path:
213227
return [usr_path / "ansible_collections"]
214228
return iterdir(self)

tests/unit/test_treemaker.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ def test_tree_empty(
1717
output: Output,
1818
tmp_path: Path,
1919
) -> None:
20-
"""Test tree_not_dict."""
20+
"""Test tree_not_dict.
21+
22+
Args:
23+
capsys: Pytest stdout capture fixture.
24+
output: Output class object.
25+
tmp_path: Pytest fixture.
26+
"""
2127
venv_path = tmp_path / "venv"
2228
EnvBuilder().create(venv_path)
2329

@@ -65,6 +71,8 @@ def collect_manifests(
6571
Args:
6672
target: Target path.
6773
venv_cache_dir: Venv cache directory.
74+
Returns:
75+
Collection info.
6876
"""
6977
assert target
7078
assert venv_cache_dir
@@ -117,6 +125,8 @@ def collect_manifests(
117125
Args:
118126
target: Target path.
119127
venv_cache_dir: Venv cache directory.
128+
Returns:
129+
Collection info.
120130
"""
121131
assert target
122132
assert venv_cache_dir
@@ -171,6 +181,8 @@ def collect_manifests(
171181
Args:
172182
target: Target path.
173183
venv_cache_dir: Venv cache directory.
184+
Returns:
185+
Collection info.
174186
"""
175187
assert target
176188
assert venv_cache_dir
@@ -223,6 +235,8 @@ def collect_manifests(
223235
Args:
224236
target: Target path.
225237
venv_cache_dir: Venv cache directory.
238+
Returns:
239+
Collection info.
226240
"""
227241
assert target
228242
assert venv_cache_dir

0 commit comments

Comments
 (0)