Skip to content

Commit b232cc5

Browse files
committed
Add some tests
1 parent 7c321b2 commit b232cc5

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

tests/test_argparser.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ def test_no_option_string(
1515
"""Test an argument without an option string.
1616
1717
Args:
18+
<<<<<<< HEAD
1819
capsys: Pytest fixture.
20+
=======
21+
capsys (pytest.CaptureFixture[str]): Pytest fixture.
22+
>>>>>>> 556acba (Add some tests)
1923
"""
2024
parser = ArgumentParser(
2125
formatter_class=CustomHelpFormatter,
@@ -36,7 +40,11 @@ def test_one_string(
3640
"""Test an argument without an option string.
3741
3842
Args:
43+
<<<<<<< HEAD
3944
capsys: Pytest fixture.
45+
=======
46+
capsys (pytest.CaptureFixture[str]): Pytest fixture.
47+
>>>>>>> 556acba (Add some tests)
4048
"""
4149
parser = ArgumentParser(
4250
formatter_class=CustomHelpFormatter,
@@ -58,7 +66,11 @@ def test_too_many_string(
5866
"""Test an argument with too many option strings.
5967
6068
Args:
69+
<<<<<<< HEAD
6170
monkeypatch: Pytest fixture.
71+
=======
72+
monkeypatch (pytest.MonkeyPatch): Pytest fixture.
73+
>>>>>>> 556acba (Add some tests)
6274
"""
6375
monkeypatch.setattr("sys.argv", ["prog", "--help"])
6476

@@ -80,7 +92,11 @@ def test_group_no_title(capsys: pytest.CaptureFixture[str]) -> None:
8092
"""Test a group without a title.
8193
8294
Args:
95+
<<<<<<< HEAD
8396
capsys: Pytest fixture.
97+
=======
98+
capsys (pytest.CaptureFixture[str]): Pytest fixture.
99+
>>>>>>> 556acba (Add some tests)
84100
"""
85101
parser = ArgumentParser(
86102
formatter_class=CustomHelpFormatter,

tests/unit/test_cli.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ def main(cli: Cli) -> None:
1212
"""Stub main function for testing.
1313
1414
Args:
15+
<<<<<<< HEAD
1516
cli: Cli object.
17+
=======
18+
cli (Cli): Cli object.
19+
>>>>>>> 556acba (Add some tests)
1620
"""
1721
cli.parse_args()
1822
cli.init_output()
@@ -24,7 +28,11 @@ def test_cpi(monkeypatch: pytest.MonkeyPatch) -> None:
2428
"""Test the cpi option.
2529
2630
Args:
31+
<<<<<<< HEAD
2732
monkeypatch: Pytest fixture.
33+
=======
34+
monkeypatch (pytest.MonkeyPatch): Pytest fixture.
35+
>>>>>>> 556acba (Add some tests)
2836
"""
2937
monkeypatch.setattr("sys.argv", ["ansible-dev-environment", "install", "--cpi"])
3038
cli = Cli()
@@ -40,7 +48,11 @@ def test_tty(monkeypatch: pytest.MonkeyPatch) -> None:
4048
"""Test term features with tty.
4149
4250
Args:
51+
<<<<<<< HEAD
4352
monkeypatch: Pytest fixture.
53+
=======
54+
monkeypatch (pytest.MonkeyPatch): Pytest fixture.
55+
>>>>>>> 556acba (Add some tests)
4456
"""
4557
monkeypatch.setattr("sys.stdout.isatty", (lambda: True))
4658
monkeypatch.setattr("os.environ", {"NO_COLOR": ""})
@@ -85,8 +97,12 @@ def test_editable_many(
8597
"""Test the editable option with too many arguments.
8698
8799
Args:
100+
<<<<<<< HEAD
88101
capsys: Pytest stdout capture fixture.
89102
monkeypatch: Pytest fixture.
103+
=======
104+
monkeypatch (pytest.MonkeyPatch): Pytest fixture.
105+
>>>>>>> 556acba (Add some tests)
90106
"""
91107
monkeypatch.setattr(
92108
"sys.argv",
@@ -143,7 +159,10 @@ def test_acp_env_var_set(
143159
"""Test the ansible collection path environment variable set.
144160
145161
Args:
162+
<<<<<<< HEAD
146163
env_var: Environment variable name.
164+
=======
165+
>>>>>>> 556acba (Add some tests)
147166
capsys: Pytest stdout capture fixture.
148167
monkeypatch: Pytest fixture.
149168
"""
@@ -200,6 +219,7 @@ def test_collections_in_user(
200219
exists = Path.exists
201220

202221
def _exists(self: Path) -> bool:
222+
<<<<<<< HEAD
203223
"""Patch the exists method.
204224
205225
Args:
@@ -208,6 +228,9 @@ def _exists(self: Path) -> bool:
208228
Returns:
209229
bool: True if the path exists.
210230
"""
231+
=======
232+
"""Patch the exists method."""
233+
>>>>>>> 556acba (Add some tests)
211234
if self == usr_path:
212235
return True
213236
return exists(self)
@@ -217,6 +240,7 @@ def _exists(self: Path) -> bool:
217240
iterdir = Path.iterdir
218241

219242
def _iterdir(self: Path) -> list[Path] | Generator[Path, None, None]:
243+
<<<<<<< HEAD
220244
"""Patch the iterdir method.
221245
222246
Args:
@@ -225,6 +249,9 @@ def _iterdir(self: Path) -> list[Path] | Generator[Path, None, None]:
225249
Returns:
226250
List of paths or generator.
227251
"""
252+
=======
253+
"""Patch the iterdir method."""
254+
>>>>>>> 556acba (Add some tests)
228255
if self == usr_path:
229256
return [usr_path / "ansible_collections"]
230257
return iterdir(self)

tests/unit/test_treemaker.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,12 @@ def collect_manifests(
7171
Args:
7272
target: Target path.
7373
venv_cache_dir: Venv cache directory.
74+
<<<<<<< HEAD
7475
7576
Returns:
7677
Collection info.
78+
=======
79+
>>>>>>> 556acba (Add some tests)
7780
"""
7881
assert target
7982
assert venv_cache_dir
@@ -126,9 +129,12 @@ def collect_manifests(
126129
Args:
127130
target: Target path.
128131
venv_cache_dir: Venv cache directory.
132+
<<<<<<< HEAD
129133
130134
Returns:
131135
Collection info.
136+
=======
137+
>>>>>>> 556acba (Add some tests)
132138
"""
133139
assert target
134140
assert venv_cache_dir
@@ -183,9 +189,12 @@ def collect_manifests(
183189
Args:
184190
target: Target path.
185191
venv_cache_dir: Venv cache directory.
192+
<<<<<<< HEAD
186193
187194
Returns:
188195
Collection info.
196+
=======
197+
>>>>>>> 556acba (Add some tests)
189198
"""
190199
assert target
191200
assert venv_cache_dir
@@ -238,9 +247,12 @@ def collect_manifests(
238247
Args:
239248
target: Target path.
240249
venv_cache_dir: Venv cache directory.
250+
<<<<<<< HEAD
241251
242252
Returns:
243253
Collection info.
254+
=======
255+
>>>>>>> 556acba (Add some tests)
244256
"""
245257
assert target
246258
assert venv_cache_dir

0 commit comments

Comments
 (0)