Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruchip16 committed Sep 13, 2023
1 parent eabb3c3 commit a40b145
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/pytest_ansible/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def pytest_generate_tests(metafunc):
raise pytest.UsageError(exception)

# Return the host name as a string
metafunc.parametrize("ansible_host", hosts.keys())
metafunc.parametrize("ansible_host", iter(hosts[h] for h in hosts))

if "ansible_group" in metafunc.fixturenames:
# assert required --ansible-* parameters were used
Expand All @@ -259,15 +259,11 @@ def pytest_generate_tests(metafunc):
)
except ansible.errors.AnsibleError as exception:
raise pytest.UsageError(exception)

# Fetch groups using inventory manager
inventory_manager = hosts.options["inventory_manager"]
groups = inventory_manager.list_groups()
groups = hosts.options["inventory_manager"].list_groups()
extra_groups = hosts.get_extra_inventory_groups()

# Return the group names as strings
group_names = groups + extra_groups
metafunc.parametrize("ansible_group", group_names)
# Return the group name as a string
metafunc.parametrize("ansible_group", iter(hosts[g] for g in groups))
metafunc.parametrize("ansible_group", iter(hosts[g] for g in extra_groups))

if "molecule_scenario" in metafunc.fixturenames:
if not HAS_MOLECULE:
Expand Down

0 comments on commit a40b145

Please sign in to comment.