Run tests on Python 3.6 (#5162)
* Run tests on Python 3.6 * Fix dsmr test * Fix async util tests * Fix rest sensor test
This commit is contained in:
parent
fdd3fa7d80
commit
9eed03108f
5 changed files with 8 additions and 4 deletions
|
@ -12,6 +12,8 @@ matrix:
|
|||
env: TOXENV=typing
|
||||
- python: "3.5"
|
||||
env: TOXENV=py35
|
||||
- python: "3.6"
|
||||
env: TOXENV=py36
|
||||
allow_failures:
|
||||
- python: "3.5"
|
||||
env: TOXENV=typing
|
||||
|
|
|
@ -11,7 +11,7 @@ from unittest.mock import Mock
|
|||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.components.sensor.dsmr import DerivativeDSMREntity
|
||||
from homeassistant.const import STATE_UNKNOWN
|
||||
from tests.common import assert_setup_component
|
||||
from tests.common import assert_setup_component, mock_coro
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
|
@ -35,7 +35,7 @@ def test_default_setup(hass, monkeypatch):
|
|||
}
|
||||
|
||||
# mock for injecting DSMR telegram
|
||||
dsmr = Mock(return_value=Mock())
|
||||
dsmr = Mock(return_value=mock_coro([Mock(), None]))
|
||||
monkeypatch.setattr('dsmr_parser.protocol.create_dsmr_reader', dsmr)
|
||||
|
||||
with assert_setup_component(1):
|
||||
|
@ -66,6 +66,7 @@ def test_default_setup(hass, monkeypatch):
|
|||
assert power_tariff.attributes.get('unit_of_measurement') is None
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def test_derivative():
|
||||
"""Test calculation of derivative value."""
|
||||
from dsmr_parser.objects import MBusObject
|
||||
|
|
|
@ -200,7 +200,7 @@ class TestRestData(unittest.TestCase):
|
|||
self.rest.update()
|
||||
self.assertEqual('test data', self.rest.data)
|
||||
|
||||
@patch('requests.get', side_effect=RequestException)
|
||||
@patch('requests.Session', side_effect=RequestException)
|
||||
def test_update_request_exception(self, mock_req):
|
||||
"""Test update when a request exception occurs."""
|
||||
self.rest.update()
|
||||
|
|
|
@ -87,6 +87,7 @@ class RunCoroutineThreadsafeTests(test_utils.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
"""Test setup method."""
|
||||
super().setUp()
|
||||
self.loop = asyncio.new_event_loop()
|
||||
self.set_event_loop(self.loop) # Will cleanup properly
|
||||
|
||||
|
|
2
tox.ini
2
tox.ini
|
@ -1,5 +1,5 @@
|
|||
[tox]
|
||||
envlist = py34, py35, lint, requirements, typing
|
||||
envlist = py34, py35, py36, lint, requirements, typing
|
||||
skip_missing_interpreters = True
|
||||
|
||||
[testenv]
|
||||
|
|
Loading…
Add table
Reference in a new issue