Example #1
0
def test_sec_timedelta():
    a = UpdatedTime('test', pd_now(UTC))
    w1 = a.add_watch(1)

    # We return the same object because it is the same time
    assert w1 is a.add_watch(timedelta(seconds=1))

    w2 = a.add_watch(timedelta(seconds=3))
    assert w2.fut.secs == 3

    w3 = a.add_watch(timedelta(minutes=3))
    assert w3.fut.secs == 3 * 60

    w1.cancel()
    w2.cancel()
    w3.cancel()
Example #2
0
def u():
    a = UpdatedTime('test', pd_now(UTC))
    w1 = a.add_watch(1)
    w2 = a.add_watch(3)

    yield a

    # cancel the rest of the running tasks
    w1.cancel()
    w2.cancel()
Example #3
0
def u():
    a = UpdatedTime('test', datetime.now(tz=pytz.utc))
    w1 = a.add_watch(1)
    w2 = a.add_watch(3)

    yield a

    # cancel the rest of the running tasks
    w1.cancel()
    w2.cancel()