Skip to content

Commit acee9cc

Browse files
committed
Additional test
1 parent ff52338 commit acee9cc

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

.config/pydoclint-baseline.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,3 @@ tests/unit/test_treemaker.py
55
DOC101: Method `SafeEnvBuilder.__init__`: Docstring contains fewer arguments than in function signature.
66
DOC103: Method `SafeEnvBuilder.__init__`: Docstring arguments are different from function arguments. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Arguments in the function signature but not in the docstring: [clear: bool, prompt: str | None, symlinks: bool, system_site_packages: bool, upgrade: bool, upgrade_deps: bool, with_pip: bool].
77
--------------------
8-
tests/unit/test_utils.py
9-
DOC502: Function `test_builder_found` has a "Raises" section in the docstring, but there are not "raise" statements in the body
10-
--------------------

tests/unit/test_utils.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
)
1414
from ansible_dev_environment.config import Config
1515
from ansible_dev_environment.output import Output
16-
from ansible_dev_environment.utils import TermFeatures, builder_introspect, str_to_bool
16+
from ansible_dev_environment.utils import (
17+
TermFeatures,
18+
builder_introspect,
19+
opt_deps_to_files,
20+
str_to_bool,
21+
)
1722

1823

1924
term_features = TermFeatures(color=False, links=False)
@@ -196,3 +201,36 @@ def test_str_to_bool() -> None:
196201
assert str_to_bool("off") is False
197202

198203
assert str_to_bool("anything else") is None
204+
205+
206+
def test_opt_deps_to_files(tmp_path: Path, capsys: pytest.LogCaptureFixture) -> None:
207+
"""Test the opt_deps_to_files function.
208+
209+
Args:
210+
tmp_path: A temporary path
211+
"""
212+
# Create a temporary file with some content
213+
f1 = tmp_path / "test-requirements.txt"
214+
f1.touch()
215+
f2 = tmp_path / "requirements-dev.txt"
216+
f2.touch()
217+
218+
collection = Collection(
219+
config=config,
220+
cname="cname",
221+
cnamespace="cnamespace",
222+
local=True,
223+
path=tmp_path,
224+
specifier="",
225+
original=str(tmp_path),
226+
opt_deps="test,dev,foo",
227+
csource=[],
228+
)
229+
230+
result = opt_deps_to_files(collection, output)
231+
232+
captured = capsys.readouterr()
233+
234+
assert result[0] == f1
235+
assert result[1] == f2
236+
assert "Error: Failed to find optional dependency file for 'foo'." in captured.err

0 commit comments

Comments
 (0)