Fix more deprecation warnings (#7778)
* Remove setting up an hbmqtt broker * Don't pass loop to web.Application in tests * Use .query instead of deprecated .GET for aiohttp requests * Fix closing file resource * Do not use asyncio mark * Notify.html5 - PyJWT: Use options to disable verify * Yamaha: Test was still using deprecated ip * Remove pytest-asyncio
This commit is contained in:
1 parent
910020bc5f
commit
e68bd0457c
20 files changed
+22
-26
No files matched your search
+1
-1
@@ -250,7 +250,7 @@ def mock_http_component_app(hass, api_password=None):
|
||||
"""Create an aiohttp.web.Application instance for testing."""
|
||||
if 'http' not in hass.config.components:
|
||||
mock_http_component(hass, api_password)
|
||||
app = web.Application(middlewares=[auth_middleware], loop=hass.loop)
|
||||
app = web.Application(middlewares=[auth_middleware])
|
||||
app['hass'] = hass
|
||||
app[KEY_USE_X_FORWARDED_FOR] = False
|
||||
app[KEY_BANS_ENABLED] = False
|
||||
|
||||
@@ -69,7 +69,6 @@ class TestComponentsDeviceTrackerJSONMQTT(unittest.TestCase):
|
||||
topic = 'location/zanzito'
|
||||
location = json.dumps(LOCATION_MESSAGE)
|
||||
|
||||
self.hass.config.components = set(['mqtt_json', 'zone'])
|
||||
assert setup_component(self.hass, device_tracker.DOMAIN, {
|
||||
device_tracker.DOMAIN: {
|
||||
CONF_PLATFORM: 'mqtt_json',
|
||||
@@ -88,7 +87,6 @@ class TestComponentsDeviceTrackerJSONMQTT(unittest.TestCase):
|
||||
topic = 'location/zanzito'
|
||||
location = 'home'
|
||||
|
||||
self.hass.config.components = set(['mqtt_json'])
|
||||
assert setup_component(self.hass, device_tracker.DOMAIN, {
|
||||
device_tracker.DOMAIN: {
|
||||
CONF_PLATFORM: 'mqtt_json',
|
||||
@@ -110,7 +108,6 @@ class TestComponentsDeviceTrackerJSONMQTT(unittest.TestCase):
|
||||
topic = 'location/zanzito'
|
||||
location = json.dumps(LOCATION_MESSAGE_INCOMPLETE)
|
||||
|
||||
self.hass.config.components = set(['mqtt_json'])
|
||||
assert setup_component(self.hass, device_tracker.DOMAIN, {
|
||||
device_tracker.DOMAIN: {
|
||||
CONF_PLATFORM: 'mqtt_json',
|
||||
|
||||
@@ -73,7 +73,7 @@ class TestYamaha(unittest.TestCase):
|
||||
def setUp(self):
|
||||
"""Setup things to be run when tests are started."""
|
||||
super(TestYamaha, self).setUp()
|
||||
self.rec = FakeYamaha('10.0.0.0')
|
||||
self.rec = FakeYamaha("http://10.0.0.0:80/YamahaRemoteControl/ctrl")
|
||||
|
||||
def test_get_playback_support(self):
|
||||
"""Test the playback."""
|
||||
|
||||
@@ -63,9 +63,9 @@ class TestCommandLine(unittest.TestCase):
|
||||
blocking=True)
|
||||
)
|
||||
|
||||
result = open(filename).read()
|
||||
# the echo command adds a line break
|
||||
self.assertEqual(result, "{}\n".format(message))
|
||||
with open(filename) as fil:
|
||||
# the echo command adds a line break
|
||||
self.assertEqual(fil.read(), "{}\n".format(message))
|
||||
|
||||
@patch('homeassistant.components.notify.command_line._LOGGER.error')
|
||||
def test_error_for_none_zero_exit_code(self, mock_error):
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"""Test config utils."""
|
||||
# pylint: disable=protected-access
|
||||
import asyncio
|
||||
import os
|
||||
import unittest
|
||||
import unittest.mock as mock
|
||||
@@ -546,7 +547,7 @@ def test_merge_duplicate_keys(merge_log_err):
|
||||
assert len(config['input_select']) == 1
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@asyncio.coroutine
|
||||
def test_merge_customize(hass):
|
||||
"""Test loading core config onto hass object."""
|
||||
core_config = {
|
||||
|
||||
Reference in new issue
Block a user