Skip to content

Commit 79cd84a

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 79cd84a

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

test/integration/test_display_callback.py

Lines changed: 11 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
@@ -13,15 +15,21 @@
1315

1416
HERE = os.path.abspath(os.path.dirname(__file__))
1517

18+
@pytest.fixture()
19+
def default_envvars():
20+
return {
21+
"ANSIBLE_PYTHON_INTERPRETER": ANSIBLE_PYTHON_INTERPRETER,
22+
"ANSIBLE_DEPRECATION_WARNINGS": "False"
23+
}
1624

1725
@pytest.fixture()
18-
def executor(tmpdir, request):
26+
def executor(tmpdir, request, default_envvars):
1927
private_data_dir = six.text_type(tmpdir.mkdir('foo'))
2028

2129
playbooks = request.node.callspec.params.get('playbook')
2230
playbook = list(playbooks.values())[0]
2331
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"}
32+
envvars = envvars.update(default_envvars) if envvars is not None else default_envvars
2533

2634
r = init_runner(
2735
private_data_dir=private_data_dir,
@@ -167,7 +175,7 @@ def test_callback_plugin_no_log_filters(executor, playbook):
167175
- shell: echo "PUBLIC"
168176
- shell: echo "PRIVATE"
169177
no_log: true
170-
- uri: url=https://example.org username="PUBLIC" password="PRIVATE"
178+
- uri: url=https://example.org user="PUBLIC" password="PRIVATE"
171179
- copy: content="PRIVATE" dest="/tmp/tmp_no_log"
172180
'''}, # noqa
173181
])

0 commit comments

Comments
 (0)