Skip to content

Commit 0d7c850

Browse files
committed
Add test to verify that all coroutine hooks will work in debug mode
1 parent 931caf7 commit 0d7c850

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ after_success:
1818

1919
env:
2020
- PYTHONPATH=.
21+
- PYTHONASYNCIODEBUG=1

tests/core_tests/test_plugin_hooks.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
"""
22
Validates all hook registrations in all plugins
33
"""
4+
import asyncio
45
import importlib
6+
import inspect
57
import re
68
from numbers import Number
79
from pathlib import Path
@@ -134,3 +136,9 @@ def test_hook_args(hook):
134136

135137
for arg in hook.required_args:
136138
assert hasattr(event, arg), "Undefined parameter '{}' for hook function".format(arg)
139+
140+
141+
def test_coroutine_hooks(hook):
142+
if inspect.isgeneratorfunction(hook.function):
143+
assert asyncio.iscoroutinefunction(hook.function), \
144+
"Non-coroutine generator function used for a hook. This is most liekly due to incorrect ordering of the hook/coroutine decorators."

0 commit comments

Comments
 (0)