1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 04:50:05 +00:00

Fix PEP257 issues

This commit is contained in:
Fabian Affolter
2016-03-09 10:25:50 +01:00
parent d6eab03a61
commit 9838697d2b
120 changed files with 1447 additions and 1297 deletions

View File

@@ -1,9 +1,4 @@
"""
tests.components.test_shell_command
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests Shell command component.
"""
"""The tests for the Shell command component."""
import os
import tempfile
import unittest
@@ -16,17 +11,18 @@ from tests.common import get_test_home_assistant
class TestShellCommand(unittest.TestCase):
""" Test the demo module. """
"""Test the Shell command component."""
def setUp(self): # pylint: disable=invalid-name
"""Setup things to be run when tests are started."""
self.hass = get_test_home_assistant()
def tearDown(self): # pylint: disable=invalid-name
""" Stop down stuff we started. """
"""Stop everything that was started."""
self.hass.stop()
def test_executing_service(self):
""" Test if able to call a configured service. """
"""Test if able to call a configured service."""
with tempfile.TemporaryDirectory() as tempdirname:
path = os.path.join(tempdirname, 'called.txt')
self.assertTrue(shell_command.setup(self.hass, {
@@ -41,13 +37,13 @@ class TestShellCommand(unittest.TestCase):
self.assertTrue(os.path.isfile(path))
def test_config_not_dict(self):
""" Test if config is not a dict. """
"""Test if config is not a dict."""
self.assertFalse(shell_command.setup(self.hass, {
'shell_command': ['some', 'weird', 'list']
}))
def test_config_not_valid_service_names(self):
""" Test if config contains invalid service names. """
"""Test if config contains invalid service names."""
self.assertFalse(shell_command.setup(self.hass, {
'shell_command': {
'this is invalid because space': 'touch bla.txt'
@@ -57,6 +53,7 @@ class TestShellCommand(unittest.TestCase):
side_effect=SubprocessError)
@patch('homeassistant.components.shell_command._LOGGER.error')
def test_subprocess_raising_error(self, mock_call, mock_error):
"""Test subprocess."""
with tempfile.TemporaryDirectory() as tempdirname:
path = os.path.join(tempdirname, 'called.txt')
self.assertTrue(shell_command.setup(self.hass, {