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

⬆️ Update dependency ruff to v0.3.1 #343

Merged
merged 2 commits into from
Mar 7, 2024
Merged
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
38 changes: 19 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pytest-asyncio = "0.23.5"
pytest-cov = "4.1.0"
pytest-freezer = "0.4.8"
pytz = "2024.1"
ruff = "0.2.2"
ruff = "0.3.1"
types-pytz = "2024.1.0.20240203"
yamllint = "1.35.1"

Expand Down
1 change: 1 addition & 0 deletions src/easyenergy/const.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Constants for EasyEnergy API client."""

from __future__ import annotations

from enum import Enum
Expand Down
1 change: 1 addition & 0 deletions src/easyenergy/easyenergy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Asynchronous Python client for the easyEnergy API."""

from __future__ import annotations

import asyncio
Expand Down
1 change: 1 addition & 0 deletions src/easyenergy/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Data models for the easyEnergy API."""

from __future__ import annotations

from dataclasses import dataclass
Expand Down
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Asynchronous Python client for the easyEnergy API."""

from pathlib import Path


Expand Down
40 changes: 25 additions & 15 deletions tests/test_easyenergy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Basic tests for the easyEnergy API."""

# pylint: disable=protected-access
import asyncio
from typing import Any
Expand Down Expand Up @@ -91,23 +92,29 @@ async def test_client_error() -> None:
"""Test request client error is handled correctly."""
async with ClientSession() as session:
client = EasyEnergy(session=session)
with patch.object(
session,
"request",
side_effect=ClientError,
), pytest.raises(EasyEnergyConnectionError):
with (
patch.object(
session,
"request",
side_effect=ClientError,
),
pytest.raises(EasyEnergyConnectionError),
):
assert await client._request("test")


async def test_dns_error() -> None:
"""Test request DNS error is handled correctly."""
async with ClientSession() as session:
client = EasyEnergy(session=session)
with patch.object(
DNSResolver,
"query",
side_effect=DNSError,
), pytest.raises(EasyEnergyConnectionError):
with (
patch.object(
DNSResolver,
"query",
side_effect=DNSError,
),
pytest.raises(EasyEnergyConnectionError),
):
assert await client._request("test")


Expand All @@ -117,9 +124,12 @@ async def test_empty_dns_error() -> None:
client = EasyEnergy(session=session)
dns_result: Any = asyncio.Future()
dns_result.set_result(None)
with patch.object(
DNSResolver,
"query",
return_value=dns_result,
), pytest.raises(EasyEnergyConnectionError):
with (
patch.object(
DNSResolver,
"query",
return_value=dns_result,
),
pytest.raises(EasyEnergyConnectionError),
):
assert await client._request("test")
1 change: 1 addition & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the models."""

from datetime import UTC, date, datetime

import pytest
Expand Down