1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Speed up mqtt tests (#73423)

Co-authored-by: jbouwh <jan@jbsoft.nl>
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
This commit is contained in:
J. Nick Koston
2022-06-13 10:17:10 -10:00
committed by GitHub
parent 034c0c0593
commit 51b4d15c8c
29 changed files with 281 additions and 10 deletions

View File

@@ -5,7 +5,12 @@ from unittest.mock import patch
import pytest
from homeassistant.components import button
from homeassistant.const import ATTR_ENTITY_ID, ATTR_FRIENDLY_NAME, STATE_UNKNOWN
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_FRIENDLY_NAME,
STATE_UNKNOWN,
Platform,
)
from homeassistant.setup import async_setup_component
from .test_common import (
@@ -41,6 +46,13 @@ DEFAULT_CONFIG = {
}
@pytest.fixture(autouse=True)
def button_platform_only():
"""Only setup the button platform to speed up tests."""
with patch("homeassistant.components.mqtt.PLATFORMS", [Platform.BUTTON]):
yield
@pytest.mark.freeze_time("2021-11-08 13:31:44+00:00")
async def test_sending_mqtt_commands(hass, mqtt_mock_entry_with_yaml_config):
"""Test the sending MQTT commands."""