Skip to content

Commit 3d450f0

Browse files
Klaus ZerwesKlaus Zerwes
authored andcommitted
fix interpreter discovery tests for changed python interpreter behaviour from ansible 2.12 on
1 parent b9782de commit 3d450f0

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

tests/ansible/integration/interpreter_discovery/ansible_2_8_tests.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,31 @@
6363
ping:
6464
register: legacy
6565

66-
- name: check for dep warning (only on platforms where auto result is not /usr/bin/python and legacy is)
66+
# from ansible 2.12 on this changed
67+
# - https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_5.html#python-interpreter-discovery
68+
# - https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html
69+
# default discovery methot is now auto and will default to python3
70+
# and the message changed from a deprecation warning to a real warning that can not be suppressed by
71+
# using deprecation_warnings=False
72+
- name: check for dep warning (only on platforms where auto result is not /usr/bin/python and legacy is) for ansible 2.8-2.11
6773
assert:
6874
that:
6975
- legacy.deprecations | default([]) | length > 0
7076
fail_msg: legacy={{legacy}}
7177
# only check for a dep warning if legacy returned /usr/bin/python and auto didn't
7278
when: legacy.ansible_facts.discovered_interpreter_python == '/usr/bin/python' and
73-
auto_out.ansible_facts.discovered_interpreter_python != '/usr/bin/python'
79+
auto_out.ansible_facts.discovered_interpreter_python != '/usr/bin/python' and
80+
ansible_version.full is version_compare('2.12.0', '<', strict=True)
7481

82+
- name: check for warning (only on platforms where auto result is not /usr/bin/python and legacy is) from ansible 2.12 on
83+
assert:
84+
that:
85+
- legacy.warnings | default([]) | length > 0
86+
fail_msg: legacy={{legacy}}
87+
# only check for a warning if legacy returned /usr/bin/python and auto didn't
88+
when: legacy.ansible_facts.discovered_interpreter_python == '/usr/bin/python' and
89+
auto_out.ansible_facts.discovered_interpreter_python != '/usr/bin/python' and
90+
ansible_version.full is version_compare('2.12.0', '>=', strict=True)
7591

7692
- name: test that auto_silent never warns and got the same answer as auto
7793
block:

0 commit comments

Comments
 (0)