2018-12-19 09:28:33 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# Copyright: (c) 2018, Ansible Project
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
|
2019-08-09 17:31:13 +02:00
|
|
|
from __future__ import (absolute_import, division, print_function)
|
2018-12-19 09:28:33 +01:00
|
|
|
__metaclass__ = type
|
|
|
|
|
2019-08-14 17:32:26 +02:00
|
|
|
import sys
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
from ansible import constants as C
|
2019-04-23 20:54:39 +02:00
|
|
|
from ansible.cli.arguments import option_helpers as opt_help
|
2019-08-14 17:32:26 +02:00
|
|
|
from ansible import __path__ as ansible_path
|
|
|
|
from ansible.release import __version__ as ansible_version
|
|
|
|
|
|
|
|
if C.DEFAULT_MODULE_PATH is None:
|
|
|
|
cpath = u'Default w/o overrides'
|
|
|
|
else:
|
|
|
|
cpath = C.DEFAULT_MODULE_PATH
|
|
|
|
|
|
|
|
FAKE_PROG = u'ansible-cli-test'
|
|
|
|
VERSION_OUTPUT = opt_help.version(prog=FAKE_PROG)
|
2018-12-19 09:28:33 +01:00
|
|
|
|
|
|
|
|
2019-08-14 17:32:26 +02:00
|
|
|
@pytest.mark.parametrize(
|
|
|
|
'must_have', [
|
|
|
|
FAKE_PROG + u' %s' % ansible_version,
|
|
|
|
u'config file = %s' % C.CONFIG_FILE,
|
|
|
|
u'configured module search path = %s' % cpath,
|
|
|
|
u'ansible python module location = %s' % ':'.join(ansible_path),
|
2020-06-25 07:58:56 +02:00
|
|
|
u'ansible collection location = %s' % ':'.join(C.COLLECTIONS_PATHS),
|
2019-08-14 17:32:26 +02:00
|
|
|
u'executable location = ',
|
|
|
|
u'python version = %s' % ''.join(sys.version.splitlines()),
|
|
|
|
]
|
|
|
|
)
|
|
|
|
def test_option_helper_version(must_have):
|
|
|
|
assert must_have in VERSION_OUTPUT
|