Skip to content

Commit

Permalink
Automatically install tests/requirements.yml when found (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored May 15, 2023
1 parent d099028 commit f93bf7c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/ansible_compat/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ def prepare_environment( # noqa: C901
"requirements.yml",
"roles/requirements.yml",
"collections/requirements.yml",
# These is more of less the official way to store test requirements in collections so far:
"tests/requirements.yml",
]:
self.install_requirements(Path(req_file), retry=retry, offline=offline)

Expand Down
3 changes: 3 additions & 0 deletions test/collections/acme.goodies/tests/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
collections:
- name: ansible.posix
version: ">=1.0"
7 changes: 6 additions & 1 deletion test/test_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,12 @@ def test_runtime_version_in_range(
@pytest.mark.parametrize(
("path", "scenario", "expected_collections"),
(
pytest.param("test/collections/acme.goodies", "default", [], id="normal"),
pytest.param(
"test/collections/acme.goodies",
"default",
["ansible.posix"],
id="normal",
),
pytest.param(
"test/collections/acme.goodies/roles/baz",
"deep_scenario",
Expand Down

0 comments on commit f93bf7c

Please sign in to comment.