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, 2023
1 parent b1cf0fc commit 7c278d7
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 5 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=2023.3.0&labelColor=blue)
![HA core version](https://img.shields.io/static/v1?label=HA+core+version&message=2023.3.1&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 @@
2023.3.0
2023.3.1
132 changes: 132 additions & 0 deletions pytest_homeassistant_custom_component/asyncio_legacy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
"""
Minimal legacy asyncio.coroutine.
This file is originally from homeassistant/core and modified by pytest-homeassistant-custom-component.
"""

# flake8: noqa
# stubbing out for integrations that have
# not yet been updated for python 3.11
# but can still run on python 3.10
#
# Remove this once rflink, fido, and blackbird
# have had their libraries updated to remove
# asyncio.coroutine
from asyncio import base_futures, constants, format_helpers
from asyncio.coroutines import _is_coroutine
import collections.abc
import functools
import inspect
import logging
import traceback
import types
import warnings

logger = logging.getLogger(__name__)


class CoroWrapper:
# Wrapper for coroutine object in _DEBUG mode.

def __init__(self, gen, func=None):
assert inspect.isgenerator(gen) or inspect.iscoroutine(gen), gen
self.gen = gen
self.func = func # Used to unwrap @coroutine decorator
self._source_traceback = format_helpers.extract_stack(sys._getframe(1))
self.__name__ = getattr(gen, "__name__", None)
self.__qualname__ = getattr(gen, "__qualname__", None)

def __iter__(self):
return self

def __next__(self):
return self.gen.send(None)

def send(self, value):
return self.gen.send(value)

def throw(self, type, value=None, traceback=None):
return self.gen.throw(type, value, traceback)

def close(self):
return self.gen.close()

@property
def gi_frame(self):
return self.gen.gi_frame

@property
def gi_running(self):
return self.gen.gi_running

@property
def gi_code(self):
return self.gen.gi_code

def __await__(self):
return self

@property
def gi_yieldfrom(self):
return self.gen.gi_yieldfrom

def __del__(self):
# Be careful accessing self.gen.frame -- self.gen might not exist.
gen = getattr(self, "gen", None)
frame = getattr(gen, "gi_frame", None)
if frame is not None and frame.f_lasti == -1:
msg = f"{self!r} was never yielded from"
tb = getattr(self, "_source_traceback", ())
if tb:
tb = "".join(traceback.format_list(tb))
msg += (
f"\nCoroutine object created at "
f"(most recent call last, truncated to "
f"{constants.DEBUG_STACK_DEPTH} last lines):\n"
)
msg += tb.rstrip()
logger.error(msg)


def legacy_coroutine(func):
"""Decorator to mark coroutines.
If the coroutine is not yielded from before it is destroyed,
an error message is logged.
"""
warnings.warn(
'"@coroutine" decorator is deprecated since Python 3.8, use "async def" instead',
DeprecationWarning,
stacklevel=2,
)
if inspect.iscoroutinefunction(func):
# In Python 3.5 that's all we need to do for coroutines
# defined with "async def".
return func

if inspect.isgeneratorfunction(func):
coro = func
else:

@functools.wraps(func)
def coro(*args, **kw):
res = func(*args, **kw)
if (
base_futures.isfuture(res)
or inspect.isgenerator(res)
or isinstance(res, CoroWrapper)
):
res = yield from res
else:
# If 'res' is an awaitable, run it.
try:
await_meth = res.__await__
except AttributeError:
pass
else:
if isinstance(res, collections.abc.Awaitable):
res = yield from await_meth()
return res

wrapper = types.coroutine(coro)
wrapper._is_coroutine = _is_coroutine # For iscoroutinefunction().
return wrapper
2 changes: 1 addition & 1 deletion pytest_homeassistant_custom_component/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
APPLICATION_NAME: Final = "HomeAssistant"
MAJOR_VERSION: Final = 2023
MINOR_VERSION: Final = 3
PATCH_VERSION: Final = "0"
PATCH_VERSION: Final = "1"
__short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__: Final = f"{__short_version__}.{PATCH_VERSION}"
REQUIRED_PYTHON_VER: Final[tuple[int, int, int]] = (3, 10, 0)
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 @@ respx==0.20.1
syrupy==4.0.0
tomli==2.0.1;python_version<"3.11"
tqdm==4.64.0
homeassistant==2023.3.0
homeassistant==2023.3.1
sqlalchemy==2.0.4

paho-mqtt==1.6.1
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.13.4
0.13.5

0 comments on commit 7c278d7

Please sign in to comment.