Fix broken tests (#11395)

* Do not leave remember the milk config file behind

* Fix exception in service causing service timeout

* Change max service timeout to 9 to catch services timing out

* Fix Google Sync service test

* Update and pin test requirements
This commit is contained in:
Paulus Schoutsen 2018-01-01 14:30:09 -08:00 committed by GitHub
parent b9c852392c
commit 6e63a4ed8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 32 deletions

View File

@ -5,15 +5,14 @@ flake8==3.3
pylint==1.6.5 pylint==1.6.5
mypy==0.560 mypy==0.560
pydocstyle==1.1.1 pydocstyle==1.1.1
coveralls>=1.1 coveralls==1.2.0
pytest>=2.9.2 pytest==3.3.1
pytest-aiohttp>=0.1.3 pytest-aiohttp==0.3.0
pytest-cov>=2.3.1 pytest-cov==2.5.1
pytest-timeout>=1.2.0 pytest-timeout>=1.2.1
pytest-catchlog>=1.2.2 pytest-sugar==0.9.0
pytest-sugar>=0.7.1 requests_mock==1.4
requests_mock>=1.0 mock-open==1.3.1
mock-open>=1.3.1
flake8-docstrings==1.0.2 flake8-docstrings==1.0.2
asynctest>=0.8.0 asynctest>=0.11.1
freezegun>=0.3.8 freezegun==0.3.9

View File

@ -6,18 +6,17 @@ flake8==3.3
pylint==1.6.5 pylint==1.6.5
mypy==0.560 mypy==0.560
pydocstyle==1.1.1 pydocstyle==1.1.1
coveralls>=1.1 coveralls==1.2.0
pytest>=2.9.2 pytest==3.3.1
pytest-aiohttp>=0.1.3 pytest-aiohttp==0.3.0
pytest-cov>=2.3.1 pytest-cov==2.5.1
pytest-timeout>=1.2.0 pytest-timeout>=1.2.1
pytest-catchlog>=1.2.2 pytest-sugar==0.9.0
pytest-sugar>=0.7.1 requests_mock==1.4
requests_mock>=1.0 mock-open==1.3.1
mock-open>=1.3.1
flake8-docstrings==1.0.2 flake8-docstrings==1.0.2
asynctest>=0.8.0 asynctest>=0.11.1
freezegun>=0.3.8 freezegun==0.3.9
# homeassistant.components.notify.html5 # homeassistant.components.notify.html5

View File

@ -38,7 +38,8 @@ class TestConfiguration(unittest.TestCase):
def test_create_new(self): def test_create_new(self):
"""Test creating a new config file.""" """Test creating a new config file."""
with patch("builtins.open", mock_open()), \ with patch("builtins.open", mock_open()), \
patch("os.path.isfile", Mock(return_value=False)): patch("os.path.isfile", Mock(return_value=False)), \
patch.object(rtm.RememberTheMilkConfiguration, 'save_config'):
config = rtm.RememberTheMilkConfiguration(self.hass) config = rtm.RememberTheMilkConfiguration(self.hass)
config.set_token(self.profile, self.token) config.set_token(self.profile, self.token)
self.assertEqual(config.get_token(self.profile), self.token) self.assertEqual(config.get_token(self.profile), self.token)
@ -65,7 +66,8 @@ class TestConfiguration(unittest.TestCase):
timeseries_id = "my_timeseries" timeseries_id = "my_timeseries"
rtm_id = "rtm-id-4567" rtm_id = "rtm-id-4567"
with patch("builtins.open", mock_open()), \ with patch("builtins.open", mock_open()), \
patch("os.path.isfile", Mock(return_value=False)): patch("os.path.isfile", Mock(return_value=False)), \
patch.object(rtm.RememberTheMilkConfiguration, 'save_config'):
config = rtm.RememberTheMilkConfiguration(self.hass) config = rtm.RememberTheMilkConfiguration(self.hass)
self.assertEqual(None, config.get_rtm_id(self.profile, hass_id)) self.assertEqual(None, config.get_rtm_id(self.profile, hass_id))

View File

@ -109,6 +109,7 @@ class TestShellCommand(unittest.TestCase):
def test_template_render(self, mock_call): def test_template_render(self, mock_call):
"""Ensure shell_commands with templates get rendered properly.""" """Ensure shell_commands with templates get rendered properly."""
self.hass.states.set('sensor.test_state', 'Works') self.hass.states.set('sensor.test_state', 'Works')
mock_call.return_value = mock_process_creator(error=False)
self.assertTrue( self.assertTrue(
setup_component(self.hass, shell_command.DOMAIN, { setup_component(self.hass, shell_command.DOMAIN, {
shell_command.DOMAIN: { shell_command.DOMAIN: {

View File

@ -12,7 +12,7 @@ setenv =
whitelist_externals = /usr/bin/env whitelist_externals = /usr/bin/env
install_command = /usr/bin/env LANG=C.UTF-8 pip install {opts} {packages} install_command = /usr/bin/env LANG=C.UTF-8 pip install {opts} {packages}
commands = commands =
py.test --timeout=15 --duration=10 --cov --cov-report= {posargs} py.test --timeout=9 --duration=10 --cov --cov-report= {posargs}
deps = deps =
-r{toxinidir}/requirements_test_all.txt -r{toxinidir}/requirements_test_all.txt
-c{toxinidir}/homeassistant/package_constraints.txt -c{toxinidir}/homeassistant/package_constraints.txt