|
11 | 11 |
|
12 | 12 | import pytest
|
13 | 13 |
|
| 14 | +HERE = os.path.abspath(os.path.dirname(__file__)) |
| 15 | + |
14 | 16 |
|
15 | 17 | @pytest.fixture()
|
16 | 18 | def executor(tmpdir, request):
|
17 | 19 | private_data_dir = six.text_type(tmpdir.mkdir('foo'))
|
18 | 20 |
|
19 | 21 | playbooks = request.node.callspec.params.get('playbook')
|
20 | 22 | playbook = list(playbooks.values())[0]
|
| 23 | + envvars = request.node.callspec.params.get('envvars') |
| 24 | + envvars = envvars.update({"ANSIBLE_DEPRECATION_WARNINGS": "False"}) if envvars is not None else {"ANSIBLE_DEPRECATION_WARNINGS": "False"} |
21 | 25 |
|
22 | 26 | r = init_runner(
|
23 | 27 | private_data_dir=private_data_dir,
|
24 | 28 | inventory="localhost ansible_connection=local",
|
25 |
| - envvars={"ANSIBLE_DEPRECATION_WARNINGS": "False"}, |
| 29 | + envvars=envvars, |
26 | 30 | playbook=yaml.safe_load(playbook)
|
27 | 31 | )
|
28 | 32 |
|
@@ -57,7 +61,11 @@ def executor(tmpdir, request):
|
57 | 61 | var: results
|
58 | 62 | '''}, # noqa
|
59 | 63 | ])
|
60 |
| -def test_callback_plugin_receives_events(executor, event, playbook): |
| 64 | +@pytest.mark.parametrize('envvars', [ |
| 65 | + {'ANSIBLE_CALLBACK_PLUGINS': os.path.join(HERE, 'callback')}, |
| 66 | + {'ANSIBLE_CALLBACK_PLUGINS': ''} |
| 67 | +]) |
| 68 | +def test_callback_plugin_receives_events(executor, event, playbook, envvars): |
61 | 69 | executor.run()
|
62 | 70 | assert len(list(executor.events))
|
63 | 71 | assert event in [task['event'] for task in executor.events]
|
|
0 commit comments