* Add support for async device discovery * FIx missing dispatcher cleanup breaking integration reload * Update homeassistant/components/gree/climate.py Co-authored-by: Erik Montnemery <erik@montnemery.com> * Update homeassistant/components/gree/switch.py Co-authored-by: Erik Montnemery <erik@montnemery.com> * Update homeassistant/components/gree/bridge.py Co-authored-by: Erik Montnemery <erik@montnemery.com> * Working on feedback * Improving load/unload tests * Update homeassistant/components/gree/__init__.py Co-authored-by: Erik Montnemery <erik@montnemery.com> * Working on more feedback * Add tests covering async discovery scenarios * Remove unnecessary shutdown * Update homeassistant/components/gree/__init__.py Co-authored-by: Erik Montnemery <erik@montnemery.com> * Code refactor from reviews Co-authored-by: Erik Montnemery <erik@montnemery.com>
24 lines
646 B
Python
24 lines
646 B
Python
"""Pytest module configuration."""
|
|
from unittest.mock import patch
|
|
|
|
import pytest
|
|
|
|
from .common import FakeDiscovery, build_device_mock
|
|
|
|
|
|
@pytest.fixture(autouse=True, name="discovery")
|
|
def discovery_fixture():
|
|
"""Patch the discovery object."""
|
|
with patch("homeassistant.components.gree.bridge.Discovery") as mock:
|
|
mock.return_value = FakeDiscovery()
|
|
yield mock
|
|
|
|
|
|
@pytest.fixture(autouse=True, name="device")
|
|
def device_fixture():
|
|
"""Patch the device search and bind."""
|
|
with patch(
|
|
"homeassistant.components.gree.bridge.Device",
|
|
return_value=build_device_mock(),
|
|
) as mock:
|
|
yield mock
|