Missing await in coroutine call

Calling a coroutine without the await statement just returns the coroutine without actually running the function.

This can have the unexpected side-effect that your code is not executed at all. This demonstrates the importance of unit testing to highlight such issues.

If our GitHub code review bot spots this issue in your pull request it gives this advice:

code-review-doctorbotsuggested changes just now
async.py
1
+
async def task():
2
+
    download_files()
Suggested changes
-
    download_files()
+
    await download_files()
Expand 3 lines ...
Commit suggestion

Calling a coroutine without the await statement just returns the coroutine without actually running the function.

Read more
3
+
	
4
+
async def download_files():
5
+
    pass
Update async.py
We're your Python code review copilot. Get code improvements right in your pull request with our GitHub code review bot.

Configuring this check

Code Review Doctor will run this check by default. No configuration is needed but the check can be turned on/off using check code await-async-call in your pyproject.toml file.

Read more about configuring Code Review Doctor.