add support for custom py3 ansible virtualenvs

This commit is contained in:
Ryan Petrello
2019-01-16 17:14:08 -05:00
parent 27f98163ff
commit 65641c7edd
6 changed files with 54 additions and 8 deletions

View File

@@ -87,6 +87,7 @@ def job(mocker):
'launch_type': 'manual',
'verbosity': 1,
'awx_meta_vars.return_value': {},
'ansible_virtualenv_path': '',
'inventory.get_script_data.return_value': {}})
ret.project = mocker.MagicMock(scm_revision='asdf1234')
return ret

View File

@@ -173,12 +173,14 @@ def test_extract_ansible_vars():
def test_get_custom_venv_choices():
bundled_venv = os.path.join(settings.BASE_VENV_PATH, 'ansible', '')
assert common.get_custom_venv_choices() == [bundled_venv]
bundled_venv_py3 = os.path.join(settings.BASE_VENV_PATH, 'ansible3', '')
assert sorted(common.get_custom_venv_choices()) == [bundled_venv, bundled_venv_py3]
with TemporaryDirectory(dir=settings.BASE_VENV_PATH, prefix='tmp') as temp_dir:
os.makedirs(os.path.join(temp_dir, 'bin', 'activate'))
assert sorted(common.get_custom_venv_choices()) == [
bundled_venv,
bundled_venv_py3,
os.path.join(temp_dir, '')
]