CLI - Specify jinja version in --version output
This commit is contained in:
parent
488b9d6c35
commit
a2593b5e27
3 changed files with 8 additions and 2 deletions
2
changelogs/fragments/version-jinja.yml
Normal file
2
changelogs/fragments/version-jinja.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- CLI - Specify jinja version in ``--version`` output
|
|
@ -19,6 +19,8 @@ try:
|
|||
except ImportError:
|
||||
HAS_LIBYAML = False
|
||||
|
||||
from jinja2 import __version__ as j2_version
|
||||
|
||||
import ansible
|
||||
from ansible import constants as C
|
||||
from ansible.module_utils._text import to_native
|
||||
|
@ -172,6 +174,7 @@ def version(prog=None):
|
|||
result.append(" ansible collection location = %s" % ':'.join(C.COLLECTIONS_PATHS))
|
||||
result.append(" executable location = %s" % sys.argv[0])
|
||||
result.append(" python version = %s" % ''.join(sys.version.splitlines()))
|
||||
result.append(" jinja version = %s" % j2_version)
|
||||
result.append(" libyaml = %s" % HAS_LIBYAML)
|
||||
return "\n".join(result)
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ def test_ansible_version(capsys, mocker):
|
|||
# Python 2.6 does return a named tuple, so get the first item
|
||||
version_lines = version[0].splitlines()
|
||||
|
||||
assert len(version_lines) == 8, 'Incorrect number of lines in "ansible --version" output'
|
||||
assert len(version_lines) == 9, 'Incorrect number of lines in "ansible --version" output'
|
||||
assert re.match('ansible [0-9.a-z]+$', version_lines[0]), 'Incorrect ansible version line in "ansible --version" output'
|
||||
assert re.match(' config file = .*$', version_lines[1]), 'Incorrect config file line in "ansible --version" output'
|
||||
assert re.match(' configured module search path = .*$', version_lines[2]), 'Incorrect module search path in "ansible --version" output'
|
||||
|
@ -112,4 +112,5 @@ def test_ansible_version(capsys, mocker):
|
|||
assert re.match(' ansible collection location = .*$', version_lines[4]), 'Incorrect collection location in "ansible --version" output'
|
||||
assert re.match(' executable location = .*$', version_lines[5]), 'Incorrect executable locaction in "ansible --version" output'
|
||||
assert re.match(' python version = .*$', version_lines[6]), 'Incorrect python version in "ansible --version" output'
|
||||
assert re.match(' libyaml = .*$', version_lines[7]), 'Missing libyaml in "ansible --version" output'
|
||||
assert re.match(' jinja version = .*$', version_lines[7]), 'Incorrect jinja version in "ansible --version" output'
|
||||
assert re.match(' libyaml = .*$', version_lines[8]), 'Missing libyaml in "ansible --version" output'
|
||||
|
|
Loading…
Reference in a new issue