Run flake8 on the AWX collection in CI

This commit is contained in:
Alan Rominger
2021-07-09 12:01:28 -04:00
parent adb6661015
commit 08cb497689
18 changed files with 14 additions and 36 deletions

View File

@@ -31,7 +31,7 @@ try:
# Because awxkit will be a directory at the root of this makefile and we are using python3, import awxkit will work even if its not installed.
# However, awxkit will not contain api whih causes a stack failure down on line 170 when we try to mock it.
# So here we are importing awxkit.api to prevent that. Then you only get an error on tests for awxkit functionality.
import awxkit.api
import awxkit.api # noqa
HAS_AWX_KIT = True
except ImportError:

View File

@@ -5,7 +5,7 @@ __metaclass__ = type
import pytest
from awx.main.models import Organization
from awx.main.models.oauth import OAuth2AccessToken, OAuth2Application
from awx.main.models.oauth import OAuth2Application
@pytest.mark.django_db

View File

@@ -4,7 +4,7 @@ __metaclass__ = type
import pytest
from awx.main.models import CredentialInputSource, Credential, CredentialType, Organization
from awx.main.models import CredentialInputSource, Credential, CredentialType
@pytest.fixture

View File

@@ -5,7 +5,6 @@ __metaclass__ = type
import pytest
from awx.main.models import InstanceGroup, Instance
from awx.main.tests.functional.conftest import kube_credential, credentialtype_kube
@pytest.mark.django_db

View File

@@ -4,7 +4,7 @@ __metaclass__ = type
import pytest
from awx.main.models import Inventory, Credential
from awx.main.models import Inventory
@pytest.mark.django_db

View File

@@ -194,6 +194,9 @@ def test_job_template_with_wrong_survey_spec(run_module, admin_user, project, in
assert result.get('failed', True)
assert result.get('msg') == "Failed to update survey: Field 'description' is missing from survey spec."
assert jt.survey_spec == survey_spec
assert ActivityStream.objects.count() == prior_ct
@pytest.mark.django_db
def test_job_template_with_survey_encrypted_default(run_module, admin_user, project, inventory, silence_warning):

View File

@@ -171,7 +171,7 @@ def test_conflicting_name_and_id(run_module, admin_user):
"""
org_by_id = Organization.objects.create(name='foo')
slug = str(org_by_id.id)
org_by_name = Organization.objects.create(name=slug)
Organization.objects.create(name=slug)
result = run_module('team', {'name': 'foo_team', 'description': 'fooin around', 'organization': slug}, admin_user)
assert not result.get('failed', False), result.get('msg', result)
team = Team.objects.filter(name='foo_team').first()
@@ -189,7 +189,7 @@ def test_multiple_lookup(run_module, admin_user):
scm_type='git',
scm_url="https://github.com/ansible/ansible-tower-samples",
)
proj2 = Project.objects.create(
Project.objects.create(
name='foo',
organization=org2,
scm_type='git',