mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 09:47:13 +00:00
Move blackbird imports (#27849)
* Move imports in blackbird component * fixed tests after import move to top level
This commit is contained in:
parent
c0d084fb04
commit
3bb46d5080
@ -2,9 +2,11 @@
|
|||||||
import logging
|
import logging
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
|
from pyblackbird import get_blackbird
|
||||||
|
from serial import SerialException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice, PLATFORM_SCHEMA
|
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
SUPPORT_SELECT_SOURCE,
|
SUPPORT_SELECT_SOURCE,
|
||||||
@ -72,9 +74,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
port = config.get(CONF_PORT)
|
port = config.get(CONF_PORT)
|
||||||
host = config.get(CONF_HOST)
|
host = config.get(CONF_HOST)
|
||||||
|
|
||||||
from pyblackbird import get_blackbird
|
|
||||||
from serial import SerialException
|
|
||||||
|
|
||||||
connection = None
|
connection = None
|
||||||
if port is not None:
|
if port is not None:
|
||||||
try:
|
try:
|
||||||
|
@ -180,7 +180,10 @@ class TestBlackbirdMediaPlayer(unittest.TestCase):
|
|||||||
self.hass = tests.common.get_test_home_assistant()
|
self.hass = tests.common.get_test_home_assistant()
|
||||||
self.hass.start()
|
self.hass.start()
|
||||||
# Note, source dictionary is unsorted!
|
# Note, source dictionary is unsorted!
|
||||||
with mock.patch("pyblackbird.get_blackbird", new=lambda *a: self.blackbird):
|
with mock.patch(
|
||||||
|
"homeassistant.components.blackbird.media_player.get_blackbird",
|
||||||
|
new=lambda *a: self.blackbird,
|
||||||
|
):
|
||||||
setup_platform(
|
setup_platform(
|
||||||
self.hass,
|
self.hass,
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user