Skip to content

Commit

Permalink
fix(tests): Scope the plugin loader to pytest session
Browse files Browse the repository at this point in the history
  • Loading branch information
haidaraM committed Sep 3, 2024
1 parent c26c84b commit 34e0aef
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ def display():
return display


@pytest.fixture(scope="session", autouse=True)
def init_ansible_plugin_loader():
"""
Init the Ansible plugin loader responsible to find the collections and stuff
This init plugin is called in CLI.run but here we are not using that.
It was called automatically in ansible-core < 2.15 but changed in https://github.com/ansible/ansible/pull/78915
:return:
"""
init_plugin_loader()


@pytest.fixture
def grapher_cli(request) -> PlaybookGrapherCLI:
"""
Expand All @@ -69,7 +80,4 @@ def grapher_cli(request) -> PlaybookGrapherCLI:
args_params[-1] = os.path.join(FIXTURES_DIR, args_params[-1])
cli = PlaybookGrapherCLI([__prog__] + args_params)
cli.parse()
# This init plugin is called in CLI.run but here we are not using that.
# It was called automatically in ansible-core < 2.15 but changed in https://github.com/ansible/ansible/pull/78915
init_plugin_loader()
return cli

0 comments on commit 34e0aef

Please sign in to comment.