예제 #1
0
def test_lazy_load_error(monkeypatch):
    """When using lazy loading, the correct exception should be
    re-raised.
    """

    class BadExc(Exception):
        pass

    def bad_load():
        raise BadExc

    lazy = DispatchingApp(bad_load, use_eager_loading=False)

    with pytest.raises(BadExc):
        lazy._flush_bg_loading_exception()
예제 #2
0
def test_lazy_load_error(monkeypatch):
    """When using lazy loading, the correct exception should be
    re-raised.
    """
    class BadExc(Exception):
        pass

    def bad_load():
        raise BadExc

    lazy = DispatchingApp(bad_load, use_eager_loading=False)

    with pytest.raises(BadExc):
        # reduce flakiness by waiting for the internal loading lock
        with lazy._lock:
            lazy._flush_bg_loading_exception()