mirror of
https://github.com/quay/quay.git
synced 2025-04-18 10:44:06 +03:00
chore: fix isort config and remove isort: skip_file
(#2196)
* chore: pass config to isort as it doesn't always detect it * chore: mark package "test" as local, not stdlib * chore: remove "isort: skip_file" * chore: fix app in test_load_security_information * chore: fix app in test_notification * chore: fix app in test_index_report
This commit is contained in:
parent
02feee3efe
commit
84fa795ae7
@ -11,7 +11,7 @@ repos:
|
||||
rev: 5.12.0
|
||||
hooks:
|
||||
- id: isort
|
||||
args: ["--profile", "black", "--filter-files"]
|
||||
args: ["--settings-path", "pyproject.toml"]
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: config-files-check
|
||||
|
@ -1,9 +1,5 @@
|
||||
import logging
|
||||
import os
|
||||
from collections import namedtuple
|
||||
|
||||
from data.database import Manifest
|
||||
from data.registry_model.datatypes import Manifest as ManifestDataType
|
||||
from data.secscan_model.datatypes import (
|
||||
ScanLookupStatus,
|
||||
SecurityInformationLookupResult,
|
||||
|
@ -1,9 +1,7 @@
|
||||
from test.fixtures import *
|
||||
|
||||
import pytest
|
||||
from mock import Mock, patch
|
||||
|
||||
from app import app, instance_keys, storage
|
||||
from app import instance_keys, storage
|
||||
from data.database import IndexerVersion, IndexStatus, ManifestSecurityStatus
|
||||
from data.registry_model import registry_model
|
||||
from data.secscan_model import secscan_model
|
||||
@ -14,6 +12,9 @@ from data.secscan_model.datatypes import (
|
||||
from data.secscan_model.secscan_v4_model import IndexReportState
|
||||
from data.secscan_model.secscan_v4_model import ScanToken as V4ScanToken
|
||||
from data.secscan_model.secscan_v4_model import V4SecurityScanner
|
||||
from test.fixtures import *
|
||||
|
||||
from app import app # isort: skip
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
@ -1,16 +1,11 @@
|
||||
# isort reordering imports breaks these tests, so tell it to skip
|
||||
# isort: skip_file
|
||||
from typing import List, Optional, Dict, Tuple, Any, Type
|
||||
from mock import patch
|
||||
from typing import Any, Dict, List, Optional, Tuple, Type
|
||||
|
||||
import pytest
|
||||
from flask_principal import AnonymousIdentity
|
||||
from mock import patch
|
||||
|
||||
import features
|
||||
from endpoints.api import api
|
||||
from endpoints.api.test.shared import conduct_api_call
|
||||
from endpoints.test.shared import client_with_identity, toggle_feature
|
||||
|
||||
from endpoints.api.appspecifictokens import *
|
||||
from endpoints.api.billing import *
|
||||
from endpoints.api.build import *
|
||||
@ -18,7 +13,9 @@ from endpoints.api.discovery import *
|
||||
from endpoints.api.globalmessages import * # type: ignore[no-redef]
|
||||
from endpoints.api.logs import * # type: ignore[no-redef]
|
||||
from endpoints.api.manifest import * # type: ignore[no-redef]
|
||||
from endpoints.api.organization import * # type: ignore[no-redef]
|
||||
from endpoints.api.mirror import * # type: ignore[no-redef]
|
||||
from endpoints.api.namespacequota import *
|
||||
from endpoints.api.organization import * # type: ignore[assignment,no-redef]
|
||||
from endpoints.api.permission import * # type: ignore[no-redef]
|
||||
from endpoints.api.prototype import *
|
||||
from endpoints.api.repoemail import * # type: ignore[no-redef]
|
||||
@ -34,13 +31,16 @@ from endpoints.api.suconfig import * # type: ignore[no-redef]
|
||||
from endpoints.api.superuser import * # type: ignore
|
||||
from endpoints.api.tag import * # type: ignore[no-redef]
|
||||
from endpoints.api.team import *
|
||||
from endpoints.api.test.shared import conduct_api_call
|
||||
from endpoints.api.trigger import *
|
||||
from endpoints.api.user import * # type: ignore[no-redef]
|
||||
from endpoints.api.mirror import * # type: ignore[no-redef]
|
||||
from endpoints.api.namespacequota import *
|
||||
from endpoints.api.user import * # type: ignore[assignment,no-redef]
|
||||
from endpoints.test.shared import client_with_identity, toggle_feature
|
||||
|
||||
from endpoints.api.repository import Repository
|
||||
# Next imports should be after all the endpoints.api imports.
|
||||
# Repository should be the API resource, not the data model.
|
||||
from endpoints.api.repository import Repository # isort: skip
|
||||
|
||||
# app should be the pytest fixture, not the Flask app.
|
||||
from test.fixtures import * # type: ignore[assignment] # isort: skip
|
||||
|
||||
ORG_PARAMS = {"orgname": "buynlarge"}
|
||||
|
@ -1,9 +1,3 @@
|
||||
# isort: skip_file
|
||||
from typing import Dict, Any
|
||||
import logging
|
||||
import json
|
||||
import hashlib
|
||||
import random
|
||||
import argparse
|
||||
import calendar
|
||||
import hashlib
|
||||
|
@ -3,6 +3,7 @@ line-length = 100
|
||||
target-version = ['py39']
|
||||
|
||||
[tool.isort]
|
||||
known_local_folder = "auth,avatars,buildman,buildtrigger,data,digest,endpoints,features,health,image,notifications,oauth,proxy,storage,test,tools,util,workers,_init,active_migration,app,config,external_libraries,initdb,path_converters,release"
|
||||
profile = "black"
|
||||
|
||||
[tool.pylint.messages_control]
|
||||
|
@ -1,18 +1,20 @@
|
||||
import unittest
|
||||
from test.fixtures import *
|
||||
|
||||
import pytest
|
||||
from mock import patch
|
||||
|
||||
from app import app, instance_keys, storage
|
||||
from app import instance_keys, storage
|
||||
from config import build_requests_session
|
||||
from data.database import ManifestSecurityStatus
|
||||
from data.registry_model import registry_model
|
||||
from data.secscan_model import secscan_model
|
||||
from test.fixtures import *
|
||||
from util.secscan.blob import BlobURLRetriever
|
||||
from util.secscan.v4.api import APIRequestFailure, ClairSecurityScannerAPI
|
||||
from util.secscan.v4.fake import fake_security_scanner
|
||||
|
||||
from app import app # isort: skip
|
||||
|
||||
|
||||
def manifest_for(namespace, repository, tagname):
|
||||
repository_ref = registry_model.lookup_repository(namespace, repository)
|
||||
|
@ -1,25 +1,21 @@
|
||||
import json
|
||||
import os
|
||||
from test.fixtures import *
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import pytest
|
||||
|
||||
from app import (
|
||||
app,
|
||||
instance_keys,
|
||||
notification_queue,
|
||||
secscan_notification_queue,
|
||||
storage,
|
||||
)
|
||||
from app import instance_keys, notification_queue, secscan_notification_queue, storage
|
||||
from data import database, model
|
||||
from data.registry_model import registry_model
|
||||
from data.secscan_model import secscan_model
|
||||
from test.fixtures import *
|
||||
from util.secscan.v4.fake import fake_security_scanner
|
||||
from workers.securityscanningnotificationworker import (
|
||||
SecurityScanningNotificationWorker,
|
||||
)
|
||||
|
||||
from app import app # isort: skip
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
os.environ.get("TEST_DATABASE_URI", "").find("mysql") >= 0, reason="Flaky on MySQL"
|
||||
|
Loading…
x
Reference in New Issue
Block a user