Skip to content

trio-timeout-without-await (TRIO100)#

Derived from the flake8-trio linter.

What it does#

Checks for trio functions that should contain await but don't.

Why is this bad?#

Some trio context managers, such as trio.fail_after and trio.move_on_after, have no effect unless they contain an await statement. The use of such functions without an await statement is likely a mistake.

Example#

async def func():
    with trio.move_on_after(2):
        do_something()

Use instead:

async def func():
    with trio.move_on_after(2):
        do_something()
        await awaitable()