1# -*- coding: utf-8 -*- 2# Copyright: (c) 2018, Ansible Project 3# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 4 5from __future__ import (absolute_import, division, print_function) 6__metaclass__ = type 7 8import sys 9 10import pytest 11 12from ansible import constants as C 13from ansible.cli.arguments import option_helpers as opt_help 14from ansible import __path__ as ansible_path 15from ansible.release import __version__ as ansible_version 16 17if C.DEFAULT_MODULE_PATH is None: 18 cpath = u'Default w/o overrides' 19else: 20 cpath = C.DEFAULT_MODULE_PATH 21 22FAKE_PROG = u'ansible-cli-test' 23VERSION_OUTPUT = opt_help.version(prog=FAKE_PROG) 24 25 26@pytest.mark.parametrize( 27 'must_have', [ 28 FAKE_PROG + u' %s' % ansible_version, 29 u'config file = %s' % C.CONFIG_FILE, 30 u'configured module search path = %s' % cpath, 31 u'ansible python module location = %s' % ':'.join(ansible_path), 32 u'executable location = ', 33 u'python version = %s' % ''.join(sys.version.splitlines()), 34 ] 35) 36def test_option_helper_version(must_have): 37 assert must_have in VERSION_OUTPUT 38