Skip to content

Commit

Permalink
Update pre-commit hooks, fix violations (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
pederhan authored Jan 14, 2025
1 parent 597f736 commit 4ce9b1c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.15
rev: v0.23
hooks:
- id: validate-pyproject
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.3
rev: v0.9.1
hooks:
# Run the linter.
- id: ruff
Expand Down
5 changes: 2 additions & 3 deletions tests/test_processing/test_zabbixupdater.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
from httpx import ConnectTimeout
from httpx import ReadTimeout

from tests.conftest import MockZabbixAPI
from tests.conftest import PicklableMock
from zabbix_auto_config import exceptions
from zabbix_auto_config.models import Settings
from zabbix_auto_config.models import ZabbixSettings
from zabbix_auto_config.processing import ZabbixUpdater
from zabbix_auto_config.state import get_manager

from ..conftest import MockZabbixAPI
from ..conftest import PicklableMock


def raises_connect_timeout(*args, **kwargs):
raise ConnectTimeout("connect timeout")
Expand Down
12 changes: 6 additions & 6 deletions zabbix_auto_config/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,12 +550,12 @@ def handle_host(
for host_modifier in self.host_modifiers:
try:
modified_host = host_modifier.module.modify(host.model_copy(deep=True))
assert isinstance(
modified_host, models.Host
), f"Modifier returned invalid type: {type(modified_host)}"
assert (
host.hostname == modified_host.hostname
), f"Modifier changed the hostname, '{host.hostname}' -> '{modified_host.hostname}'"
assert isinstance(modified_host, models.Host), (
f"Modifier returned invalid type: {type(modified_host)}"
)
assert host.hostname == modified_host.hostname, (
f"Modifier changed the hostname, '{host.hostname}' -> '{modified_host.hostname}'"
)
# Re-validate the host after modification
host = host.model_validate(modified_host)
except AssertionError as e:
Expand Down

0 comments on commit 4ce9b1c

Please sign in to comment.