Fix sanity errors for collections

This commit is contained in:
beeankha
2021-07-29 16:36:29 -04:00
parent d89719c740
commit e88e81928c
5 changed files with 14 additions and 11 deletions

View File

@@ -15,6 +15,8 @@ from requests.models import Response, PreparedRequest
import pytest
from ansible.module_utils.six import raise_from
from awx.main.tests.functional.conftest import _request
from awx.main.models import Organization, Project, Inventory, JobTemplate, Credential, CredentialType, ExecutionEnvironment, UnifiedJob
@@ -184,7 +186,7 @@ def run_module(request, collection_import):
try:
result = json.loads(module_stdout)
except Exception as e:
raise Exception('Module did not write valid JSON, error: {0}, stdout:\n{1}'.format(str(e), module_stdout)) from e
raise_from(Exception('Module did not write valid JSON, error: {0}, stdout:\n{1}'.format(str(e), module_stdout)), e)
# A module exception should never be a test expectation
if 'exception' in result:
if "ModuleNotFoundError: No module named 'tower_cli'" in result['exception']:

View File

@@ -47,4 +47,4 @@ def test_create_project_copy_from(run_module, admin_user, organization, silence_
dict(name=proj_name, copy_from='foo', scm_type='git', wait=False),
admin_user,
)
silence_warning.assert_called_with(f"A project with the name {proj_name} already exists.")
silence_warning.assert_called_with("A project with the name {0} already exists.".format(proj_name))