Skip to content

Commit 82e15eb

Browse files
committed
[test_display_callback] Use ANSIBLE_PYTHON_INTERPRETER var
Fixes test issues with new versions of ansible that have this patch: ansible/ansible#50163 Since there are tests that end up triggering this warning and mess with the event locations that are returned. Made a quick refactor to the fixture in this test file as well to break out the default env vars so it was a bit more DRY and re-usable.
1 parent 5b0046a commit 82e15eb

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

test/integration/test_display_callback.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import yaml
66
import six
77

8+
from sys import executable as ANSIBLE_PYTHON_INTERPRETER
9+
810
from ansible import __version__ as ANSIBLE_VERSION
911

1012
from ansible_runner.interface import init_runner
@@ -15,13 +17,21 @@
1517

1618

1719
@pytest.fixture()
18-
def executor(tmpdir, request):
20+
def default_envvars():
21+
return {
22+
"ANSIBLE_PYTHON_INTERPRETER": ANSIBLE_PYTHON_INTERPRETER,
23+
"ANSIBLE_DEPRECATION_WARNINGS": "False"
24+
}
25+
26+
27+
@pytest.fixture()
28+
def executor(tmpdir, request, default_envvars):
1929
private_data_dir = six.text_type(tmpdir.mkdir('foo'))
2030

2131
playbooks = request.node.callspec.params.get('playbook')
2232
playbook = list(playbooks.values())[0]
2333
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"}
34+
envvars = envvars.update(default_envvars) if envvars is not None else default_envvars
2535

2636
r = init_runner(
2737
private_data_dir=private_data_dir,
@@ -167,7 +177,7 @@ def test_callback_plugin_no_log_filters(executor, playbook):
167177
- shell: echo "PUBLIC"
168178
- shell: echo "PRIVATE"
169179
no_log: true
170-
- uri: url=https://example.org username="PUBLIC" password="PRIVATE"
180+
- uri: url=https://example.org user="PUBLIC" password="PRIVATE"
171181
- copy: content="PRIVATE" dest="/tmp/tmp_no_log"
172182
'''}, # noqa
173183
])

0 commit comments

Comments
 (0)