Skip to content

Commit d176e3e

Browse files
committed
Update test environment conditionals for Python/Ansible support
Signed-off-by: Webster Mudge <wmudge@cloudera.com>
1 parent 4c45700 commit d176e3e

File tree

2 files changed

+36
-7
lines changed

2 files changed

+36
-7
lines changed

pyproject.toml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,44 @@ lint = [
4242
]
4343

4444
[tool.hatch.envs.hatch-test]
45+
matrix-name-format = "{variable}_{value}"
4546
extra-dependencies = [
4647
"pytest",
4748
"pytest-mock",
4849
"molecule",
4950
"molecule-plugins",
5051
"molecule-plugins[ec2]",
51-
"ansible-core<2.17", # For RHEL 8 support
52+
# "ansible-core<2.17", # For RHEL 8 support
5253
"cdpy @ git+https://github.com/cloudera-labs/cdpy@main#egg=cdpy",
5354
]
5455

56+
# Ansible 2.18 - Python >= 3.11
57+
[[tool.hatch.envs.hatch-test.matrix]]
58+
python = ["3.13", "3.12", "3.11"]
59+
ansible = ["2.18"]
60+
61+
# Ansible 2.17 - Python >= 3.10
62+
[[tool.hatch.envs.hatch-test.matrix]]
63+
python = ["3.13", "3.12", "3.11", "3.10"]
64+
ansible = ["2.17"]
65+
66+
# Ansible 2.16 - Python >= 3.10
5567
[[tool.hatch.envs.hatch-test.matrix]]
56-
python = ["3.13", "3.12", "3.11", "3.10", "3.9"]
68+
python = ["3.13", "3.12", "3.11", "3.10"]
69+
ansible = ["2.16"]
70+
71+
# Ansible 2.15 - Python <= 3.12
72+
[[tool.hatch.envs.hatch-test.matrix]]
73+
python = ["3.12", "3.11", "3.10", "3.9"]
74+
ansible = ["2.15"]
75+
76+
[tool.hatch.envs.hatch-test.overrides]
77+
matrix.ansible.dependencies = [
78+
{ value = "ansible-core==2.18", if = ["2.18"] },
79+
{ value = "ansible-core==2.17", if = ["2.17"] },
80+
{ value = "ansible-core==2.16", if = ["2.16"] },
81+
{ value = "ansible-core==2.15", if = ["2.15"] },
82+
]
5783

5884
[tool.hatch.envs.docs]
5985
python = "3.12"

tests/unit/plugins/module_utils/cdp_client/test_create_encoded_authn_params_string.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,14 @@ def test_create_encoded_authn_params_string_base64_error():
229229
auth_method = "ed25519v1"
230230

231231
# Use unittest.mock directly with a more targeted approach
232-
with unittest.mock.patch(
233-
"ansible_collections.cloudera.cloud.plugins.module_utils.cdp_client.json.dumps",
234-
) as mock_dumps, unittest.mock.patch(
235-
"ansible_collections.cloudera.cloud.plugins.module_utils.cdp_client.urlsafe_b64encode",
236-
) as mock_b64encode:
232+
with (
233+
unittest.mock.patch(
234+
"ansible_collections.cloudera.cloud.plugins.module_utils.cdp_client.json.dumps",
235+
) as mock_dumps,
236+
unittest.mock.patch(
237+
"ansible_collections.cloudera.cloud.plugins.module_utils.cdp_client.urlsafe_b64encode",
238+
) as mock_b64encode,
239+
):
237240
mock_dumps.return_value = (
238241
'{"access_key_id": "test-key", "auth_method": "ed25519v1"}'
239242
)

0 commit comments

Comments
 (0)