Skip to content

Commit

Permalink
Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewFlamm committed Mar 3, 2025
1 parent 475a9a9 commit 15bfdbc
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 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=2025.3.0b2&labelColor=blue)
![HA core version](https://img.shields.io/static/v1?label=HA+core+version&message=2025.3.0b3&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 @@
2025.3.0b2
2025.3.0b3
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ requests-mock==1.12.1
respx==0.22.0
syrupy==4.8.1
tqdm==4.67.1
homeassistant==2025.3.0b2
homeassistant==2025.3.0b3
SQLAlchemy==2.0.38

paho-mqtt==2.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from unittest.mock import MagicMock, patch, sentinel

from freezegun import freeze_time
from sqlalchemy import create_engine
from sqlalchemy import create_engine, event as sqlalchemy_event
from sqlalchemy.orm.session import Session

from homeassistant import core as ha
Expand Down Expand Up @@ -418,7 +418,15 @@ def create_engine_test_for_schema_version_postfix(
schema_module = get_schema_module_path(schema_version_postfix)
importlib.import_module(schema_module)
old_db_schema = sys.modules[schema_module]
instance: Recorder | None = None
if "hass" in kwargs:
hass: HomeAssistant = kwargs.pop("hass")
instance = recorder.get_instance(hass)
engine = create_engine(*args, **kwargs)
if instance is not None:
instance = recorder.get_instance(hass)
instance.engine = engine
sqlalchemy_event.listen(engine, "connect", instance._setup_recorder_connection)
old_db_schema.Base.metadata.create_all(engine)
with Session(engine) as session:
session.add(
Expand All @@ -439,7 +447,7 @@ def get_schema_module_path(schema_version_postfix: str) -> str:


@contextmanager
def old_db_schema(schema_version_postfix: str) -> Iterator[None]:
def old_db_schema(hass: HomeAssistant, schema_version_postfix: str) -> Iterator[None]:
"""Fixture to initialize the db with the old schema."""
schema_module = get_schema_module_path(schema_version_postfix)
importlib.import_module(schema_module)
Expand All @@ -459,6 +467,7 @@ def old_db_schema(schema_version_postfix: str) -> Iterator[None]:
CREATE_ENGINE_TARGET,
new=partial(
create_engine_test_for_schema_version_postfix,
hass=hass,
schema_version_postfix=schema_version_postfix,
),
),
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_homeassistant_custom_component/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
from typing import TYPE_CHECKING, Final
MAJOR_VERSION: Final = 2025
MINOR_VERSION: Final = 3
PATCH_VERSION: Final = "0b2"
PATCH_VERSION: Final = "0b3"
__short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__: Final = f"{__short_version__}.{PATCH_VERSION}"
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.13.218
0.13.219

0 comments on commit 15bfdbc

Please sign in to comment.