示例#1
0
def test_recorder_setup_failure():
    """Test some exceptions."""
    hass = get_test_home_assistant()

    with patch.object(Recorder, '_setup_connection') as setup, \
            patch('homeassistant.components.recorder.time.sleep'):
        setup.side_effect = ImportError("driver not found")
        rec = Recorder(hass, uri='sqlite://', include={}, exclude={})
        rec.start()
        rec.join()

    hass.stop()
示例#2
0
def _default_recorder(hass):
    """Return a recorder with reasonable defaults."""
    return Recorder(
        hass,
        auto_purge=True,
        keep_days=7,
        commit_interval=1,
        uri="sqlite://",
        db_max_retries=10,
        db_retry_wait=3,
        entity_filter=CONFIG_SCHEMA({DOMAIN: {}}),
        exclude_t=[],
    )
def test_recorder_setup_failure():
    """Test some exceptions."""
    hass = get_test_home_assistant()

    with patch.object(Recorder, '_setup_connection') as setup, \
            patch('homeassistant.components.recorder.time.sleep'):
        setup.side_effect = ImportError("driver not found")
        rec = Recorder(hass, uri='sqlite://', include={}, exclude={})
        rec.start()
        rec.join()

    hass.stop()
示例#4
0
def test_recorder_setup_failure():
    """Test some exceptions."""
    hass = get_test_home_assistant()

    with patch.object(Recorder, "_setup_connection") as setup, patch(
            "homeassistant.components.recorder.time.sleep"):
        setup.side_effect = ImportError("driver not found")
        rec = Recorder(hass,
                       keep_days=7,
                       purge_interval=2,
                       uri="sqlite://",
                       include={},
                       exclude={})
        rec.start()
        rec.join()

    hass.stop()
示例#5
0
def test_recorder_setup_failure():
    """Test some exceptions."""
    hass = get_test_home_assistant()

    with patch.object(Recorder, "_setup_connection") as setup, patch(
            "homeassistant.components.recorder.time.sleep"):
        setup.side_effect = ImportError("driver not found")
        rec = Recorder(
            hass,
            auto_purge=True,
            keep_days=7,
            commit_interval=1,
            uri="sqlite://",
            db_max_retries=10,
            db_retry_wait=3,
            entity_filter=CONFIG_SCHEMA({DOMAIN: {}}),
            exclude_t=[],
        )
        rec.start()
        rec.join()

    hass.stop()