diff --git a/test/integration/test_display_callback.py b/test/integration/test_display_callback.py index 2ad4a9c03..9b651c97f 100644 --- a/test/integration/test_display_callback.py +++ b/test/integration/test_display_callback.py @@ -5,6 +5,8 @@ import yaml import six +from sys import executable as ANSIBLE_PYTHON_INTERPRETER + from ansible import __version__ as ANSIBLE_VERSION from ansible_runner.interface import init_runner @@ -13,15 +15,23 @@ HERE = os.path.abspath(os.path.dirname(__file__)) +@pytest.fixture() +def default_envvars(): + return { + "ANSIBLE_PYTHON_INTERPRETER": ANSIBLE_PYTHON_INTERPRETER, + "ANSIBLE_DEPRECATION_WARNINGS": "False" + } @pytest.fixture() -def executor(tmpdir, request): +def executor(tmpdir, request, default_envvars): private_data_dir = six.text_type(tmpdir.mkdir('foo')) playbooks = request.node.callspec.params.get('playbook') playbook = list(playbooks.values())[0] envvars = request.node.callspec.params.get('envvars') - envvars = envvars.update({"ANSIBLE_DEPRECATION_WARNINGS": "False"}) if envvars is not None else {"ANSIBLE_DEPRECATION_WARNINGS": "False"} + envvars = envvars.update(default_envvars) if envvars is not None else default_envvars + json_mode = request.node.callspec.params.get('json_mode') + json_mode = json_mode if json_mode is not None else False r = init_runner( private_data_dir=private_data_dir, @@ -171,7 +181,7 @@ def test_callback_plugin_no_log_filters(executor, playbook): - copy: content="PRIVATE" dest="/tmp/tmp_no_log" '''}, # noqa ]) -def test_callback_plugin_task_args_leak(executor, playbook): +def test_callback_plugin_task_args_leak(executor, playbook, default_envvars): executor.run() events = list(executor.events) assert events[0]['event'] == 'playbook_on_start'