Clarify CLI version number as core version (#72287)

* clarify CLI version number as core version

* reduce confusion with `ansible` PyPI package >= 2.10 drifting from core version

* fix units
This commit is contained in:
Matt Davis 2021-03-01 09:14:56 -08:00 committed by GitHub
parent 920b68f5f2
commit d0e991e892
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 3 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- CLI version displays clarified as core version

View file

@ -157,7 +157,7 @@ def _gitinfo():
def version(prog=None): def version(prog=None):
""" return ansible version """ """ return ansible version """
if prog: if prog:
result = [" ".join((prog, __version__))] result = ["{0} [core {1}] ".format(prog, __version__)]
else: else:
result = [__version__] result = [__version__]

View file

@ -25,7 +25,7 @@ VERSION_OUTPUT = opt_help.version(prog=FAKE_PROG)
@pytest.mark.parametrize( @pytest.mark.parametrize(
'must_have', [ 'must_have', [
FAKE_PROG + u' %s' % ansible_version, FAKE_PROG + u' [core %s]' % ansible_version,
u'config file = %s' % C.CONFIG_FILE, u'config file = %s' % C.CONFIG_FILE,
u'configured module search path = %s' % cpath, u'configured module search path = %s' % cpath,
u'ansible python module location = %s' % ':'.join(ansible_path), u'ansible python module location = %s' % ':'.join(ansible_path),

View file

@ -105,7 +105,7 @@ def test_ansible_version(capsys, mocker):
version_lines = version[0].splitlines() version_lines = version[0].splitlines()
assert len(version_lines) == 9, '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(r'ansible \[core [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(' 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' assert re.match(' configured module search path = .*$', version_lines[2]), 'Incorrect module search path in "ansible --version" output'
assert re.match(' ansible python module location = .*$', version_lines[3]), 'Incorrect python module location in "ansible --version" output' assert re.match(' ansible python module location = .*$', version_lines[3]), 'Incorrect python module location in "ansible --version" output'