| 1 |
# -*- coding: UTF-8 -*- |
| 2 |
""" |
| 3 |
Unit test support for :mod:`behave.api.async_test` tests. |
| 4 |
""" |
| 5 |
|
| 6 |
import inspect |
| 7 |
|
| 8 |
|
| 9 |
# ----------------------------------------------------------------------------- |
| 10 |
# TEST SUPPORT: |
| 11 |
# ----------------------------------------------------------------------------- |
| 12 |
class AsyncStepTheory(object): |
| 13 |
@staticmethod |
| 14 |
def ensure_normal_function(func): |
| 15 |
if hasattr(inspect, "isawaitable"): |
| 16 |
# -- SINCE: Python 3.5 |
| 17 |
assert not inspect.isawaitable(func) |
| 18 |
|
| 19 |
@classmethod |
| 20 |
def validate(cls, func): |
| 21 |
cls.ensure_normal_function(func) |