From 521e00e4179388a305c8354140b92a3f10398849 Mon Sep 17 00:00:00 2001 From: Andrew Scribner Date: Wed, 21 Aug 2024 08:54:57 -0400 Subject: [PATCH] fix: reorder imports for ruff 0.6.x (#392) --- src/charm.py | 1 + src/traefik.py | 1 + tests/interface/conftest.py | 3 ++- tests/scenario/conftest.py | 3 ++- tests/scenario/test_setup.py | 3 ++- tests/scenario/test_tracing_integration.py | 1 + tests/scenario/test_workload_version.py | 3 ++- tests/unit/test_charm.py | 3 ++- tests/unit/test_deep_merge.py | 1 + tests/unit/test_route.py | 3 ++- tests/unit/test_tls_certificates.py | 3 ++- 11 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/charm.py b/src/charm.py index a38bbfd5..25fc6af8 100755 --- a/src/charm.py +++ b/src/charm.py @@ -70,6 +70,7 @@ WaitingStatus, ) from ops.pebble import PathError + from traefik import ( CA, SERVER_CERT_PATH, diff --git a/src/traefik.py b/src/traefik.py index 41a21be3..b1ce72c3 100644 --- a/src/traefik.py +++ b/src/traefik.py @@ -18,6 +18,7 @@ from charms.oathkeeper.v0.forward_auth import ForwardAuthConfig from ops import Container from ops.pebble import LayerDict, PathError + from utils import is_hostname logger = logging.getLogger(__name__) diff --git a/tests/interface/conftest.py b/tests/interface/conftest.py index f06d2d5f..5df2abb2 100644 --- a/tests/interface/conftest.py +++ b/tests/interface/conftest.py @@ -3,11 +3,12 @@ from unittest.mock import patch import pytest -from charm import TraefikIngressCharm from interface_tester import InterfaceTester from ops.pebble import Layer from scenario.state import Container, ExecOutput, State +from charm import TraefikIngressCharm + # Interface tests are centrally hosted at https://github.com/canonical/charm-relation-interfaces. # this fixture is used by the test runner of charm-relation-interfaces to test traefik's compliance diff --git a/tests/scenario/conftest.py b/tests/scenario/conftest.py index 67d0a2ab..1bc7fce5 100644 --- a/tests/scenario/conftest.py +++ b/tests/scenario/conftest.py @@ -1,10 +1,11 @@ from unittest.mock import PropertyMock, patch import pytest -from charm import TraefikIngressCharm from ops import pebble from scenario import Container, Context, ExecOutput, Model, Mount +from charm import TraefikIngressCharm + MOCK_EXTERNAL_HOSTNAME = "testhostname" diff --git a/tests/scenario/test_setup.py b/tests/scenario/test_setup.py index 86f08265..6e85d040 100644 --- a/tests/scenario/test_setup.py +++ b/tests/scenario/test_setup.py @@ -5,8 +5,9 @@ from unittest.mock import PropertyMock, patch -from charm import TraefikIngressCharm from scenario import Container, Context, State + +from charm import TraefikIngressCharm from traefik import Traefik diff --git a/tests/scenario/test_tracing_integration.py b/tests/scenario/test_tracing_integration.py index 836bb233..e8fa96b2 100644 --- a/tests/scenario/test_tracing_integration.py +++ b/tests/scenario/test_tracing_integration.py @@ -6,6 +6,7 @@ from charms.tempo_k8s.v1.charm_tracing import charm_tracing_disabled from charms.tempo_k8s.v2.tracing import ProtocolType, Receiver, TracingProviderAppData from scenario import Relation, State + from traefik import CA_CERT_PATH, DYNAMIC_TRACING_PATH diff --git a/tests/scenario/test_workload_version.py b/tests/scenario/test_workload_version.py index 47224629..4a10e57c 100644 --- a/tests/scenario/test_workload_version.py +++ b/tests/scenario/test_workload_version.py @@ -4,10 +4,11 @@ import unittest from unittest.mock import PropertyMock, patch -from charm import TraefikIngressCharm from ops.model import ActiveStatus from scenario import Container, Context, State +from charm import TraefikIngressCharm + @patch("charm.KubernetesServicePatch") @patch("lightkube.core.client.GenericSyncClient") diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py index 6f32ee0f..84089a03 100644 --- a/tests/unit/test_charm.py +++ b/tests/unit/test_charm.py @@ -8,12 +8,13 @@ import ops.testing import yaml -from charm import TraefikIngressCharm from charms.traefik_k8s.v2.ingress import IngressRequirerAppData, IngressRequirerUnitData from ops.charm import ActionEvent from ops.model import ActiveStatus, Application, BlockedStatus, Relation, WaitingStatus from ops.pebble import PathError from ops.testing import Harness + +from charm import TraefikIngressCharm from traefik import STATIC_CONFIG_PATH ops.testing.SIMULATE_CAN_CONNECT = True diff --git a/tests/unit/test_deep_merge.py b/tests/unit/test_deep_merge.py index b7a5ece5..764afd70 100644 --- a/tests/unit/test_deep_merge.py +++ b/tests/unit/test_deep_merge.py @@ -1,4 +1,5 @@ import pytest + from traefik import StaticConfigMergeConflictError, static_config_deep_merge diff --git a/tests/unit/test_route.py b/tests/unit/test_route.py index 234ca176..38f80344 100644 --- a/tests/unit/test_route.py +++ b/tests/unit/test_route.py @@ -6,8 +6,9 @@ import ops import pytest import yaml -from charm import TraefikIngressCharm from ops.testing import Harness + +from charm import TraefikIngressCharm from traefik import StaticConfigMergeConflictError, Traefik MODEL_NAME = "test-model" diff --git a/tests/unit/test_tls_certificates.py b/tests/unit/test_tls_certificates.py index b6f92012..166c74e9 100644 --- a/tests/unit/test_tls_certificates.py +++ b/tests/unit/test_tls_certificates.py @@ -5,9 +5,10 @@ from unittest.mock import patch import ops.testing -from charm import TraefikIngressCharm from ops.testing import Harness +from charm import TraefikIngressCharm + ops.testing.SIMULATE_CAN_CONNECT = True