Skip to content

Commit

Permalink
Drop asynctest (home-assistant#44746)
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck authored Jan 1, 2021
1 parent 2b05565 commit 65cf2fc
Show file tree
Hide file tree
Showing 906 changed files with 1,360 additions and 1,254 deletions.
1 change: 0 additions & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

-c homeassistant/package_constraints.txt
-r requirements_test_pre_commit.txt
asynctest==0.13.0
codecov==2.1.10
coverage==5.3
jsonpickle==1.4.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Test the NEW_NAME config flow."""
from unittest.mock import patch

from homeassistant import config_entries, setup
from homeassistant.components.NEW_DOMAIN.config_flow import CannotConnect, InvalidAuth
from homeassistant.components.NEW_DOMAIN.const import DOMAIN

from tests.async_mock import patch


async def test_form(hass):
"""Test we get the form."""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Test the NEW_NAME config flow."""
from unittest.mock import patch

from homeassistant import config_entries, setup
from homeassistant.components.NEW_DOMAIN.const import (
DOMAIN,
Expand All @@ -7,8 +9,6 @@
)
from homeassistant.helpers import config_entry_oauth2_flow

from tests.async_mock import patch

CLIENT_ID = "1234"
CLIENT_SECRET = "5678"

Expand Down
9 changes: 0 additions & 9 deletions tests/async_mock.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/auth/mfa_modules/test_notify.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Test the HMAC-based One Time Password (MFA) auth module."""
import asyncio
from unittest.mock import patch

from homeassistant import data_entry_flow
from homeassistant.auth import auth_manager_from_config, models as auth_models
from homeassistant.auth.mfa_modules import auth_mfa_module_from_config
from homeassistant.components.notify import NOTIFY_SERVICE_SCHEMA

from tests.async_mock import patch
from tests.common import MockUser, async_mock_service

MOCK_CODE = "123456"
Expand Down
2 changes: 1 addition & 1 deletion tests/auth/mfa_modules/test_totp.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Test the Time-based One Time Password (MFA) auth module."""
import asyncio
from unittest.mock import patch

from homeassistant import data_entry_flow
from homeassistant.auth import auth_manager_from_config, models as auth_models
from homeassistant.auth.mfa_modules import auth_mfa_module_from_config

from tests.async_mock import patch
from tests.common import MockUser

MOCK_CODE = "123456"
Expand Down
3 changes: 1 addition & 2 deletions tests/auth/providers/test_command_line.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Tests for the command_line auth provider."""

import os
from unittest.mock import AsyncMock
import uuid

import pytest
Expand All @@ -10,8 +11,6 @@
from homeassistant.auth.providers import command_line
from homeassistant.const import CONF_TYPE

from tests.async_mock import AsyncMock


@pytest.fixture
def store(hass):
Expand Down
3 changes: 1 addition & 2 deletions tests/auth/providers/test_homeassistant.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test the Home Assistant local auth provider."""
import asyncio
from unittest.mock import Mock, patch

import pytest
import voluptuous as vol
Expand All @@ -11,8 +12,6 @@
homeassistant as hass_auth,
)

from tests.async_mock import Mock, patch


@pytest.fixture
def data(hass):
Expand Down
3 changes: 1 addition & 2 deletions tests/auth/providers/test_insecure_example.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
"""Tests for the insecure example auth provider."""
from unittest.mock import AsyncMock
import uuid

import pytest

from homeassistant.auth import AuthManager, auth_store, models as auth_models
from homeassistant.auth.providers import insecure_example

from tests.async_mock import AsyncMock


@pytest.fixture
def store(hass):
Expand Down
3 changes: 1 addition & 2 deletions tests/auth/test_auth_store.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""Tests for the auth store."""
import asyncio
from unittest.mock import patch

from homeassistant.auth import auth_store

from tests.async_mock import patch


async def test_loading_no_group_data_format(hass, hass_storage):
"""Test we correctly load old data without any groups."""
Expand Down
2 changes: 1 addition & 1 deletion tests/auth/test_init.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tests for the Home Assistant auth module."""
from datetime import timedelta
from unittest.mock import Mock, patch

import jwt
import pytest
Expand All @@ -11,7 +12,6 @@
from homeassistant.core import callback
from homeassistant.util import dt as dt_util

from tests.async_mock import Mock, patch
from tests.common import CLIENT_ID, MockUser, ensure_auth_manager_loaded, flush_store


Expand Down
3 changes: 1 addition & 2 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import pathlib
import threading
import time
from unittest.mock import AsyncMock, Mock, patch
import uuid

from aiohttp.test_utils import unused_port as get_test_instance_port # noqa
Expand Down Expand Up @@ -60,8 +61,6 @@
from homeassistant.util.unit_system import METRIC_SYSTEM
import homeassistant.util.yaml.loader as yaml_loader

from tests.async_mock import AsyncMock, Mock, patch

_LOGGER = logging.getLogger(__name__)
INSTANCES = []
CLIENT_ID = "https://example.com/app"
Expand Down
3 changes: 2 additions & 1 deletion tests/components/abode/common.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Common methods used across tests for Abode."""
from unittest.mock import patch

from homeassistant.components.abode import DOMAIN as ABODE_DOMAIN
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.setup import async_setup_component

from tests.async_mock import patch
from tests.common import MockConfigEntry


Expand Down
4 changes: 2 additions & 2 deletions tests/components/abode/test_alarm_control_panel.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Tests for the Abode alarm control panel device."""
from unittest.mock import PropertyMock, patch

import abodepy.helpers.constants as CONST

from homeassistant.components.abode import ATTR_DEVICE_ID
Expand All @@ -17,8 +19,6 @@

from .common import setup_platform

from tests.async_mock import PropertyMock, patch

DEVICE_ID = "alarm_control_panel.abode_alarm"


Expand Down
4 changes: 2 additions & 2 deletions tests/components/abode/test_camera.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Tests for the Abode camera device."""
from unittest.mock import patch

from homeassistant.components.abode.const import DOMAIN as ABODE_DOMAIN
from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN
from homeassistant.const import ATTR_ENTITY_ID, STATE_IDLE

from .common import setup_platform

from tests.async_mock import patch


async def test_entity_registry(hass):
"""Tests that the devices are registered in the entity registry."""
Expand Down
3 changes: 2 additions & 1 deletion tests/components/abode/test_config_flow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Tests for the Abode config flow."""
from unittest.mock import patch

from abodepy.exceptions import AbodeAuthenticationException
from abodepy.helpers.errors import MFA_CODE_REQUIRED

Expand All @@ -13,7 +15,6 @@
HTTP_INTERNAL_SERVER_ERROR,
)

from tests.async_mock import patch
from tests.common import MockConfigEntry

CONF_POLLING = "polling"
Expand Down
4 changes: 2 additions & 2 deletions tests/components/abode/test_cover.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Tests for the Abode cover device."""
from unittest.mock import patch

from homeassistant.components.abode import ATTR_DEVICE_ID
from homeassistant.components.cover import DOMAIN as COVER_DOMAIN
from homeassistant.const import (
Expand All @@ -11,8 +13,6 @@

from .common import setup_platform

from tests.async_mock import patch

DEVICE_ID = "cover.garage_door"


Expand Down
4 changes: 2 additions & 2 deletions tests/components/abode/test_init.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Tests for the Abode module."""
from unittest.mock import patch

from abodepy.exceptions import AbodeAuthenticationException

from homeassistant.components.abode import (
Expand All @@ -12,8 +14,6 @@

from .common import setup_platform

from tests.async_mock import patch


async def test_change_settings(hass):
"""Test change_setting service."""
Expand Down
4 changes: 2 additions & 2 deletions tests/components/abode/test_light.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Tests for the Abode light device."""
from unittest.mock import patch

from homeassistant.components.abode import ATTR_DEVICE_ID
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
Expand All @@ -17,8 +19,6 @@

from .common import setup_platform

from tests.async_mock import patch

DEVICE_ID = "light.living_room_lamp"


Expand Down
4 changes: 2 additions & 2 deletions tests/components/abode/test_lock.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Tests for the Abode lock device."""
from unittest.mock import patch

from homeassistant.components.abode import ATTR_DEVICE_ID
from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN
from homeassistant.const import (
Expand All @@ -11,8 +13,6 @@

from .common import setup_platform

from tests.async_mock import patch

DEVICE_ID = "lock.test_lock"


Expand Down
4 changes: 2 additions & 2 deletions tests/components/abode/test_switch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Tests for the Abode switch device."""
from unittest.mock import patch

from homeassistant.components.abode import (
DOMAIN as ABODE_DOMAIN,
SERVICE_TRIGGER_AUTOMATION,
Expand All @@ -14,8 +16,6 @@

from .common import setup_platform

from tests.async_mock import patch

AUTOMATION_ID = "switch.test_automation"
AUTOMATION_UID = "47fae27488f74f55b964a81a066c3a01"
DEVICE_ID = "switch.test_switch"
Expand Down
2 changes: 1 addition & 1 deletion tests/components/accuweather/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Tests for AccuWeather."""
import json
from unittest.mock import patch

from homeassistant.components.accuweather.const import DOMAIN

from tests.async_mock import patch
from tests.common import MockConfigEntry, load_fixture


Expand Down
2 changes: 1 addition & 1 deletion tests/components/accuweather/test_config_flow.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Define tests for the AccuWeather config flow."""
import json
from unittest.mock import patch

from accuweather import ApiError, InvalidApiKeyError, RequestsExceededError

Expand All @@ -8,7 +9,6 @@
from homeassistant.config_entries import SOURCE_USER
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME

from tests.async_mock import patch
from tests.common import MockConfigEntry, load_fixture

VALID_CONFIG = {
Expand Down
3 changes: 2 additions & 1 deletion tests/components/accuweather/test_init.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Test init of AccuWeather integration."""
from unittest.mock import patch

from homeassistant.components.accuweather.const import DOMAIN
from homeassistant.config_entries import (
ENTRY_STATE_LOADED,
Expand All @@ -7,7 +9,6 @@
)
from homeassistant.const import STATE_UNAVAILABLE

from tests.async_mock import patch
from tests.common import MockConfigEntry
from tests.components.accuweather import init_integration

Expand Down
2 changes: 1 addition & 1 deletion tests/components/accuweather/test_sensor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Test sensor of AccuWeather integration."""
from datetime import timedelta
import json
from unittest.mock import patch

from homeassistant.components.accuweather.const import ATTRIBUTION, DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
Expand All @@ -24,7 +25,6 @@
from homeassistant.setup import async_setup_component
from homeassistant.util.dt import utcnow

from tests.async_mock import patch
from tests.common import async_fire_time_changed, load_fixture
from tests.components.accuweather import init_integration

Expand Down
2 changes: 1 addition & 1 deletion tests/components/accuweather/test_system_health.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Test AccuWeather system health."""
import asyncio
from unittest.mock import Mock

from aiohttp import ClientError

from homeassistant.components.accuweather.const import COORDINATOR, DOMAIN
from homeassistant.setup import async_setup_component

from tests.async_mock import Mock
from tests.common import get_system_health_info


Expand Down
2 changes: 1 addition & 1 deletion tests/components/accuweather/test_weather.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Test weather of AccuWeather integration."""
from datetime import timedelta
import json
from unittest.mock import patch

from homeassistant.components.accuweather.const import ATTRIBUTION
from homeassistant.components.weather import (
Expand All @@ -25,7 +26,6 @@
from homeassistant.setup import async_setup_component
from homeassistant.util.dt import utcnow

from tests.async_mock import patch
from tests.common import async_fire_time_changed, load_fixture
from tests.components.accuweather import init_integration

Expand Down
Loading

0 comments on commit 65cf2fc

Please sign in to comment.