Exemplo n.º 1
0
def test_minimum_duration_blocking():
    """minimum_duration should block until start of next second."""
    start = int(time.time())
    blocking = True
    with minimum_duration(blocking):
        pass

    stop = int(time.time())
    assert start != stop
Exemplo n.º 2
0
def test_minimum_duration_non_blocking():
    """blocking=False should make minimum_duration return immediately."""
    start = time.time()
    blocking = False
    with minimum_duration(blocking):
        pass

    stop = time.time()
    one_ms = 0.001
    assert (stop - start) <= one_ms