How to use the aiocron.asyncio.Future function in aiocron

To help you get started, we’ve selected a few aiocron examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gawel / aiocron / tests / test_cron.py View on Github external
def test_raise():
    loop = asyncio.new_event_loop()

    future = asyncio.Future(loop=loop)

    @crontab('* * * * * *', start=False, loop=loop)
    def t():
        loop.call_later(1, future.set_result, 1)
        raise ValueError()

    t.start()
    loop.run_until_complete(future)
    t.stop()
    assert future.result() == 1
github gawel / aiocron / tests / test_cron.py View on Github external
def test_cron():
    loop = asyncio.new_event_loop()

    future = asyncio.Future(loop=loop)

    @crontab('* * * * * *', start=False, loop=loop)
    def t():
        future.set_result(1)

    t.start()
    loop.run_until_complete(future)
    t.stop()
    assert future.result() == 1

aiocron

Crontabs for asyncio

MIT
Latest version published 2 years ago

Package Health Score

52 / 100
Full package analysis

Similar packages