diff options
author | David Lord <davidism@gmail.com> | 2021-05-18 13:31:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-18 13:31:11 -0700 |
commit | 77674b9dfb56985f794bb7957a4253151b2c3d86 (patch) | |
tree | 74ea646fb8be8d89dbd6ff8ba65123c023359a75 /tests | |
parent | 94a6423a7710959912bde61d16d88d353b3312bb (diff) | |
parent | 7d0b7accff32e0ce9889fb8b81320917451b8454 (diff) | |
download | jinja2-77674b9dfb56985f794bb7957a4253151b2c3d86.tar.gz |
Merge pull request #1444 from pallets/event-loop
use asyncio.run
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_async.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/test_async.py b/tests/test_async.py index f8be8df..e1c8d23 100644 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -1,4 +1,5 @@ import asyncio +import sys import pytest @@ -13,9 +14,17 @@ from jinja2.exceptions import UndefinedError from jinja2.nativetypes import NativeEnvironment -def run(coro): - loop = asyncio.get_event_loop() - return loop.run_until_complete(coro) +if sys.version_info < (3, 7): + + def run(coro): + loop = asyncio.get_event_loop() + return loop.run_until_complete(coro) + + +else: + + def run(coro): + return asyncio.run(coro) def test_basic_async(): |