Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #45

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.0
rev: v0.9.3
hooks:
- id: ruff
args:
- --fix
- id: ruff-format
files: ^((homeassistant|pylint|script|tests)/.+)?[^/]+\.(py|pyi)$
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.0
hooks:
- id: codespell
args:
Expand All @@ -18,7 +18,7 @@ repos:
exclude_types: [csv, json, html]
exclude: ^tests/fixtures/generated/|tests/components/.*/snapshots/
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
#- id: check-yaml # disabled atm due to https://github.com/pre-commit/pre-commit-hooks/issues/577
- id: check-json
Expand All @@ -31,7 +31,7 @@ repos:
args: ["--fix=lf"]

- repo: https://github.com/psf/black
rev: 24.4.2
rev: 24.10.0
hooks:
- id: black
language_version: python3.12
Expand All @@ -49,13 +49,13 @@ repos:
- id: isort
args: [ --profile=black ]
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.28.6
rev: 0.31.0
hooks:
- id: check-github-actions
- id: check-github-workflows

- repo: https://github.com/pycqa/flake8
rev: 7.1.0
rev: 7.1.1
hooks:
- id: flake8

Expand Down
20 changes: 11 additions & 9 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ async def test_update_failure(api):
async def test_light_toggle_success(api):
api._userid = "123" # Simulate successful login
api._data = {"AA:BB:CC:DD:EE:FF-1": {"chooseGarden": 0, "lightTemp": 1}}
with patch(
"custom_components.aerogarden.api.AerogardenAPI._post_request"
) as mock_post, patch(
"custom_components.aerogarden.api.AerogardenAPI.update"
) as mock_update:
with (
patch(
"custom_components.aerogarden.api.AerogardenAPI._post_request"
) as mock_post,
patch("custom_components.aerogarden.api.AerogardenAPI.update") as mock_update,
):
mock_post.return_value = {"code": 1}
mock_update.return_value = True
result = await api.light_toggle("AA:BB:CC:DD:EE:FF-1")
Expand Down Expand Up @@ -119,10 +120,11 @@ def test_garden_property(api):
@pytest.mark.asyncio
async def test_update_throttle(api):
api._userid = "123" # Simulate successful login
with patch(
"custom_components.aerogarden.api.AerogardenAPI._post_request"
) as mock_post, patch(
"custom_components.aerogarden.api.MIN_TIME_BETWEEN_UPDATES", new=1
with (
patch(
"custom_components.aerogarden.api.AerogardenAPI._post_request"
) as mock_post,
patch("custom_components.aerogarden.api.MIN_TIME_BETWEEN_UPDATES", new=1),
):
mock_post.return_value = [{"airGuid": "AA:BB:CC:DD:EE:FF", "configID": 1}]

Expand Down
Loading