Skip to content

Commit

Permalink
fix: sorting of imports to match ruff 0.6.x (#171)
Browse files Browse the repository at this point in the history
Not sure what has changed, but linting now fails within this repo after a ruff bump.  Fixing that here
  • Loading branch information
ca-scribner authored Aug 19, 2024
1 parent b345967 commit 579b10c
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
from charms.tempo_k8s.v1.charm_tracing import trace_charm
from cosl import JujuTopology
from cosl.rules import AlertRules
from grafana_agent import METRICS_RULES_SRC_PATH, GrafanaAgentCharm
from ops.main import main
from ops.model import BlockedStatus, MaintenanceStatus, Relation

from grafana_agent import METRICS_RULES_SRC_PATH, GrafanaAgentCharm
from snap_management import SnapSpecError, install_ga_snap

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion tests/scenario/test_machine_charm/test_alert_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import json
from unittest.mock import PropertyMock, patch

import charm
import pytest
from scenario import Context, PeerRelation, Relation, State, SubordinateRelation

import charm
from tests.scenario.helpers import get_charm_meta


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import json
from unittest.mock import PropertyMock, patch

import charm
import pytest
from scenario import Context, PeerRelation, State, SubordinateRelation

import charm
from tests.scenario.helpers import get_charm_meta


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from pathlib import Path
from unittest.mock import patch

import charm
import pytest
from cosl import GrafanaDashboard
from scenario import Context, PeerRelation, State, SubordinateRelation

import charm
from tests.scenario.helpers import get_charm_meta
from tests.scenario.test_machine_charm.helpers import set_run_out

Expand Down
3 changes: 2 additions & 1 deletion tests/scenario/test_machine_charm/test_scrape_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
from pathlib import Path
from unittest.mock import patch

import charm
import pytest
import yaml
from charms.grafana_agent.v0.cos_agent import CosAgentProviderUnitData
from scenario import Context, Model, PeerRelation, Relation, State, SubordinateRelation

import charm

machine_meta = yaml.safe_load(
(
Path(inspect.getfile(charm.GrafanaAgentMachineCharm)).parent.parent / "metadata.yaml"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from typing import get_args

import pytest
from charm import GrafanaAgentMachineCharm
from charms.grafana_agent.v0.cos_agent import ReceiverProtocol
from charms.tempo_k8s.v2.tracing import ReceiverProtocol as TracingReceiverProtocol
from scenario import Context, State

from charm import GrafanaAgentMachineCharm


def test_cos_agent_receiver_protocols_match_with_tracing():
assert set(get_args(ReceiverProtocol)) == set(get_args(TracingReceiverProtocol))
Expand Down
4 changes: 2 additions & 2 deletions tests/scenario/test_setup_statuses.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from typing import Type
from unittest.mock import PropertyMock, patch

import charm
import grafana_agent
import pytest
from ops import UnknownStatus, WaitingStatus
from ops.testing import CharmType
from scenario import Context, State

import charm
import grafana_agent
from tests.scenario.helpers import get_charm_meta


Expand Down
3 changes: 2 additions & 1 deletion tests/scenario/test_start_statuses.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
from pathlib import Path
from unittest.mock import patch

import charm
import pytest
import yaml
from scenario import Context, State

import charm

CHARM_ROOT = Path(__file__).parent.parent.parent


Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_fstab_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import unittest
from pathlib import Path

from charm import SnapFstab
from fs.tempfs import TempFS

from charm import SnapFstab


class TestFstabParsing(unittest.TestCase):
"""Verify that fstab handling behaves appropriately."""
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_relation_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
import unittest
from unittest.mock import patch

from charm import GrafanaAgentMachineCharm as GrafanaAgentCharm
from ops.model import ActiveStatus, BlockedStatus
from ops.testing import Harness

from charm import GrafanaAgentMachineCharm as GrafanaAgentCharm


class TestRelationStatus(unittest.TestCase):
def setUp(self, *unused):
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_update_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import unittest
from unittest.mock import patch

from charm import GrafanaAgentMachineCharm as GrafanaAgentCharm
from ops.testing import Harness

from charm import GrafanaAgentMachineCharm as GrafanaAgentCharm


class TestUpdateStatus(unittest.TestCase):
def setUp(self, *unused):
Expand Down

0 comments on commit 579b10c

Please sign in to comment.