Skip to content

Commit

Permalink
Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewFlamm committed Sep 26, 2024
1 parent e269d41 commit dc3c4c7
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 37 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pytest-homeassistant-custom-component

![HA core version](https://img.shields.io/static/v1?label=HA+core+version&message=2024.9.3&labelColor=blue)
![HA core version](https://img.shields.io/static/v1?label=HA+core+version&message=2024.10.0b0&labelColor=blue)

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/MatthewFlamm/pytest-homeassistant-custom-component)

Expand Down
2 changes: 1 addition & 1 deletion ha_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024.9.3
2024.10.0b0
26 changes: 13 additions & 13 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# This file is originally from homeassistant/core and modified by pytest-homeassistant-custom-component.
astroid==3.2.4
mypy-dev==1.12.0a2
pre-commit==3.7.1
pylint==3.2.6
types-aiofiles==23.2.0.20240623
astroid==3.3.4
mypy-dev==1.12.0a3
pre-commit==3.8.0
pylint==3.3.1
types-aiofiles==24.1.0.20240626
types-atomicwrites==1.4.5.1
types-croniter==2.0.0.20240423
types-beautifulsoup4==4.12.0.20240511
types-caldav==1.3.0.20240331
types-beautifulsoup4==4.12.0.20240907
types-caldav==1.3.0.20240824
types-chardet==0.1.5
types-decorator==5.1.8.20240310
types-paho-mqtt==1.6.0.20240321
types-pillow==10.2.0.20240520
types-protobuf==4.24.0.20240106
types-psutil==6.0.0.20240621
types-python-dateutil==2.9.0.20240316
types-pillow==10.2.0.20240822
types-protobuf==4.25.0.20240417
types-psutil==6.0.0.20240901
types-python-dateutil==2.9.0.20240906
types-python-slugify==8.0.2.20240310
types-pytz==2024.1.0.20240417
types-PyYAML==6.0.12.20240311
types-pytz==2024.2.0.20240913
types-PyYAML==6.0.12.20240917
types-requests==2.31.0.3
types-xmltodict==0.13.0.3
19 changes: 9 additions & 10 deletions requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

-c homeassistant/package_constraints.txt
-r requirements_test_pre_commit.txt
coverage==7.6.0
coverage==7.6.1
freezegun==1.5.1
mock-open==1.4.0
pydantic==1.10.17
pylint-per-file-ignores==1.3.2
pipdeptree==2.23.1
pip-licenses==4.5.1
pytest-asyncio==0.23.8
pipdeptree==2.23.4
pip-licenses==5.0.0
pytest-asyncio==0.24.0
pytest-aiohttp==1.0.5
pytest-cov==5.0.0
pytest-freezer==0.4.8
Expand All @@ -26,16 +26,15 @@ pytest-timeout==2.3.1
pytest-unordered==0.6.1
pytest-picked==0.5.0
pytest-xdist==3.6.1
pytest==8.3.1
pytest==8.3.3
requests-mock==1.12.1
respx==0.21.1
syrupy==4.6.1
tqdm==4.66.4
uv==0.2.27
homeassistant==2024.9.3
syrupy==4.7.1
tqdm==4.66.5
homeassistant==2024.10.0b0
SQLAlchemy==2.0.31

paho-mqtt==1.6.1

numpy==1.26.0
numpy==1.26.4

5 changes: 4 additions & 1 deletion src/pytest_homeassistant_custom_component/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def async_fire_mqtt_message(
from paho.mqtt.client import MQTTMessage

# pylint: disable-next=import-outside-toplevel
from homeassistant.components.mqtt.models import MqttData
from homeassistant.components.mqtt import MqttData

if isinstance(payload, str):
payload = payload.encode("utf-8")
Expand Down Expand Up @@ -996,6 +996,7 @@ def __init__(
*,
data=None,
disabled_by=None,
discovery_keys=None,
domain="test",
entry_id=None,
minor_version=1,
Expand All @@ -1010,9 +1011,11 @@ def __init__(
version=1,
) -> None:
"""Initialize a mock config entry."""
discovery_keys = discovery_keys or {}
kwargs = {
"data": data or {},
"disabled_by": disabled_by,
"discovery_keys": discovery_keys,
"domain": domain,
"entry_id": entry_id or ulid_util.ulid_now(),
"minor_version": minor_version,
Expand Down
4 changes: 2 additions & 2 deletions src/pytest_homeassistant_custom_component/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""
from typing import TYPE_CHECKING, Final
MAJOR_VERSION: Final = 2024
MINOR_VERSION: Final = 9
PATCH_VERSION: Final = "3"
MINOR_VERSION: Final = 10
PATCH_VERSION: Final = "0b0"
__short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__: Final = f"{__short_version__}.{PATCH_VERSION}"
29 changes: 22 additions & 7 deletions src/pytest_homeassistant_custom_component/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,15 @@
from homeassistant.auth.models import Credentials
from homeassistant.auth.providers import homeassistant
from homeassistant.components.device_tracker.legacy import Device

# pylint: disable-next=hass-component-root-import
from homeassistant.components.websocket_api.auth import (
TYPE_AUTH,
TYPE_AUTH_OK,
TYPE_AUTH_REQUIRED,
)

# pylint: disable-next=hass-component-root-import
from homeassistant.components.websocket_api.http import URL
from homeassistant.config import YAML_CONFIG_FILE
from homeassistant.config_entries import ConfigEntries, ConfigEntry, ConfigEntryState
Expand Down Expand Up @@ -418,7 +422,7 @@ def reset_hass_threading_local_object() -> Generator[None]:
ha._hass.__dict__.clear()


@pytest.fixture(scope="session", autouse=True)
@pytest.fixture(autouse=True, scope="session")
def bcrypt_cost() -> Generator[None]:
"""Run with reduced rounds during tests, to speed up uses."""
gensalt_orig = bcrypt.gensalt
Expand Down Expand Up @@ -1297,11 +1301,21 @@ def enable_nightly_purge() -> bool:


@pytest.fixture
def enable_migrate_context_ids() -> bool:
def enable_migrate_event_context_ids() -> bool:
"""Fixture to control enabling of recorder's context id migration.
To enable context id migration, tests can be marked with:
@pytest.mark.parametrize("enable_migrate_event_context_ids", [True])
"""
return False


@pytest.fixture
def enable_migrate_state_context_ids() -> bool:
"""Fixture to control enabling of recorder's context id migration.
To enable context id migration, tests can be marked with:
@pytest.mark.parametrize("enable_migrate_context_ids", [True])
@pytest.mark.parametrize("enable_migrate_state_context_ids", [True])
"""
return False

Expand Down Expand Up @@ -1469,7 +1483,8 @@ async def async_test_recorder(
enable_statistics: bool,
enable_missing_statistics: bool,
enable_schema_validation: bool,
enable_migrate_context_ids: bool,
enable_migrate_event_context_ids: bool,
enable_migrate_state_context_ids: bool,
enable_migrate_event_type_ids: bool,
enable_migrate_entity_ids: bool,
enable_migrate_event_ids: bool,
Expand Down Expand Up @@ -1531,12 +1546,12 @@ def debug_session_scope(
)
migrate_states_context_ids = (
migration.StatesContextIDMigration.migrate_data
if enable_migrate_context_ids
if enable_migrate_state_context_ids
else None
)
migrate_events_context_ids = (
migration.EventsContextIDMigration.migrate_data
if enable_migrate_context_ids
if enable_migrate_event_context_ids
else None
)
migrate_event_type_ids = (
Expand Down Expand Up @@ -1704,7 +1719,7 @@ async def mock_enable_bluetooth(
await hass.async_block_till_done()


@pytest.fixture(scope="session")
@pytest.fixture(autouse=True, scope="session")
def mock_bluetooth_adapters() -> Generator[None]:
"""Fixture to mock bluetooth adapters."""
with (
Expand Down
15 changes: 14 additions & 1 deletion src/pytest_homeassistant_custom_component/test_util/aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from contextlib import contextmanager
from http import HTTPStatus
import re
from types import TracebackType
from typing import Any
from unittest import mock
from urllib.parse import parse_qs
Expand Down Expand Up @@ -170,7 +171,7 @@ class AiohttpClientMockResponse:
def __init__(
self,
method,
url,
url: URL,
status=HTTPStatus.OK,
response=None,
json=None,
Expand Down Expand Up @@ -301,6 +302,18 @@ def response(self):
raise ClientConnectionError("Connection closed")
return self._response

async def __aenter__(self):
"""Enter the context manager."""
return self

async def __aexit__(
self,
exc_type: type[BaseException] | None,
exc_val: BaseException | None,
exc_tb: TracebackType | None,
) -> None:
"""Exit the context manager."""


@contextmanager
def mock_aiohttp_client() -> Iterator[AiohttpClientMocker]:
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.13.164
0.13.165

0 comments on commit dc3c4c7

Please sign in to comment.