def test_logged_query_fail():
    # If the query itself fails, we should not impede that floating to top.
    failstub = StubCallable(throw=NotImplementedError('foo'))
    okstub = StubCallable()
    lgr = loggers.CallHomeStatusLogger(post=okstub)
    try:
        with loggers.logged_query(logger=lgr, **THE_USUAL):
            failstub('die')
        assert False
    except __HOLE__:
        pass
    time.sleep(0.2) # To let the call-home thread run, so this is less flaky.
    assert 1 == len(okstub.calls)
    check_logcall(okstub.calls[0])

    assert 1 == len(failstub.calls)
    assert "[(('die',), {})]" == str(failstub.calls)
dataset/ETHPy150Open probcomp/bayeslite/tests/test_loggers.py/test_logged_query_fail