Skip to content

Commit

Permalink
Run tests on Python 3.6 (home-assistant#5162)
Browse files Browse the repository at this point in the history
* Run tests on Python 3.6

* Fix dsmr test

* Fix async util tests

* Fix rest sensor test
  • Loading branch information
balloob authored Jan 3, 2017
1 parent fdd3fa7 commit 9eed031
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions tests/components/sensor/test_dsmr.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
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
Expand All @@ -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):
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/components/sensor/test_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def test_update(self, mock_req):
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()
Expand Down
1 change: 1 addition & 0 deletions tests/util/test_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py34, py35, lint, requirements, typing
envlist = py34, py35, py36, lint, requirements, typing
skip_missing_interpreters = True

[testenv]
Expand Down

0 comments on commit 9eed031

Please sign in to comment.