Hello Python 3.5 (#12610)

* Hello Python 3.5

* Fix test

* Fix tests

* Fix never awaited block till done warnings
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2018-02-22 23:22:27 -08:00
1 parent 156206dfee
commit 6ee3c1b3e5
10 files changed
+36 -56

No files matched your search

@@ -114,8 +114,6 @@ def test_valid_credentials(
result = hass.loop.run_until_complete(
async_setup_scanner(hass, config, mock_see))
hass.async_block_till_done()
assert result
assert mock_create_session.called
@@ -420,11 +420,11 @@ def test_proper_put_state_request(hue_client):
# pylint: disable=invalid-name
def perform_put_test_on_ceiling_lights(hass_hue, hue_client,
content_type='application/json'):
async def perform_put_test_on_ceiling_lights(hass_hue, hue_client,
content_type='application/json'):
"""Test the setting of a light."""
# Turn the office light off first
yield from hass_hue.services.async_call(
await hass_hue.services.async_call(
light.DOMAIN, const.SERVICE_TURN_OFF,
{const.ATTR_ENTITY_ID: 'light.ceiling_lights'},
blocking=True)
@@ -433,14 +433,14 @@ def perform_put_test_on_ceiling_lights(hass_hue, hue_client,
assert ceiling_lights.state == STATE_OFF
# Go through the API to turn it on
office_result = yield from perform_put_light_state(
office_result = await perform_put_light_state(
hass_hue, hue_client,
'light.ceiling_lights', True, 56, content_type)
assert office_result.status == 200
assert 'application/json' in office_result.headers['content-type']
office_result_json = yield from office_result.json()
office_result_json = await office_result.json()
assert len(office_result_json) == 2
+3 -3
View File
@@ -21,8 +21,8 @@ def test_subscribing_config_topic(hass, mqtt_mock):
assert call_args[2] == 0
@asyncio.coroutine
@patch('homeassistant.components.mqtt.discovery.async_load_platform')
@asyncio.coroutine
def test_invalid_topic(mock_load_platform, hass, mqtt_mock):
"""Test sending to invalid topic."""
mock_load_platform.return_value = mock_coro()
@@ -34,8 +34,8 @@ def test_invalid_topic(mock_load_platform, hass, mqtt_mock):
assert not mock_load_platform.called
@asyncio.coroutine
@patch('homeassistant.components.mqtt.discovery.async_load_platform')
@asyncio.coroutine
def test_invalid_json(mock_load_platform, hass, mqtt_mock, caplog):
"""Test sending in invalid JSON."""
mock_load_platform.return_value = mock_coro()
@@ -48,8 +48,8 @@ def test_invalid_json(mock_load_platform, hass, mqtt_mock, caplog):
assert not mock_load_platform.called
@asyncio.coroutine
@patch('homeassistant.components.mqtt.discovery.async_load_platform')
@asyncio.coroutine
def test_only_valid_components(mock_load_platform, hass, mqtt_mock, caplog):
"""Test for a valid component."""
mock_load_platform.return_value = mock_coro()
+3 -3
View File
@@ -165,7 +165,7 @@ class TestRecorderPurge(unittest.TestCase):
# run purge method - no service data, use defaults
self.hass.services.call('recorder', 'purge')
self.hass.async_block_till_done()
self.hass.block_till_done()
# Small wait for recorder thread
self.hass.data[DATA_INSTANCE].block_till_done()
@@ -177,7 +177,7 @@ class TestRecorderPurge(unittest.TestCase):
# run purge method - correct service data
self.hass.services.call('recorder', 'purge',
service_data=service_data)
self.hass.async_block_till_done()
self.hass.block_till_done()
# Small wait for recorder thread
self.hass.data[DATA_INSTANCE].block_till_done()
@@ -203,6 +203,6 @@ class TestRecorderPurge(unittest.TestCase):
self.assertFalse(self.hass.data[DATA_INSTANCE].did_vacuum)
self.hass.services.call('recorder', 'purge',
service_data=service_data)
self.hass.async_block_till_done()
self.hass.block_till_done()
self.hass.data[DATA_INSTANCE].block_till_done()
self.assertTrue(self.hass.data[DATA_INSTANCE].did_vacuum)