'Test subprocess.'

@patch('homeassistant.components.shell_command.subprocess.call', side_effect=SubprocessError)
@patch('homeassistant.components.shell_command._LOGGER.error')
def test_subprocess_raising_error(self, mock_call, mock_error):

    with tempfile.TemporaryDirectory() as tempdirname:
        path = os.path.join(tempdirname, 'called.txt')
        assert setup_component(self.hass, shell_command.DOMAIN, {shell_command.DOMAIN: {'test_service': 'touch    {}'.format(path)}})
        self.hass.services.call('shell_command', 'test_service', blocking=True)
        self.assertFalse(os.path.isfile(path))
        self.assertEqual(1, mock_error.call_count)
