Skip to content

Commit c36795a

Browse files
Merge branch 'main' into pytest-asyncio-1.0
2 parents 12d5271 + 9ff04f1 commit c36795a

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,23 @@ env:
2121

2222
jobs:
2323
test:
24-
runs-on: ubuntu-latest
24+
name: Python ${{ matrix.python-version }}
25+
runs-on: ${{ matrix.os }}
2526
strategy:
2627
fail-fast: false
2728
matrix:
29+
os: [ubuntu-24.04]
2830
python-version:
29-
- "3.7"
3031
- "3.8"
3132
- "3.9"
3233
- "3.10"
3334
- "3.11"
3435
- "3.12"
3536
- "3.13"
3637
- "3.14"
38+
include:
39+
- os: ubuntu-22.04
40+
python-version: "3.7"
3741
steps:
3842
- name: Checkout code
3943
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

backoff/_async.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
import datetime
33
import functools
44
import asyncio
5+
import inspect
56
from datetime import timedelta
67

78
from backoff._common import (_init_wait_gen, _maybe_call, _next_wait)
89

910

1011
def _ensure_coroutine(coro_or_func):
11-
if asyncio.iscoroutinefunction(coro_or_func):
12+
if inspect.iscoroutinefunction(coro_or_func):
1213
return coro_or_func
1314
else:
1415
@functools.wraps(coro_or_func)
@@ -47,10 +48,10 @@ def retry_predicate(target, wait_gen, predicate,
4748
on_giveup = _ensure_coroutines(on_giveup)
4849

4950
# Easy to implement, please report if you need this.
50-
assert not asyncio.iscoroutinefunction(max_tries)
51-
assert not asyncio.iscoroutinefunction(jitter)
51+
assert not inspect.iscoroutinefunction(max_tries)
52+
assert not inspect.iscoroutinefunction(jitter)
5253

53-
assert asyncio.iscoroutinefunction(target)
54+
assert inspect.iscoroutinefunction(target)
5455

5556
@functools.wraps(target)
5657
async def retry(*args, **kwargs):
@@ -124,8 +125,8 @@ def retry_exception(target, wait_gen, exception,
124125
giveup = _ensure_coroutine(giveup)
125126

126127
# Easy to implement, please report if you need this.
127-
assert not asyncio.iscoroutinefunction(max_tries)
128-
assert not asyncio.iscoroutinefunction(jitter)
128+
assert not inspect.iscoroutinefunction(max_tries)
129+
assert not inspect.iscoroutinefunction(jitter)
129130

130131
@functools.wraps(target)
131132
async def retry(*args, **kwargs):

backoff/_decorator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# coding:utf-8
2-
import asyncio
2+
import inspect
33
import logging
44
import operator
55
from typing import Any, Callable, Iterable, Optional, Type, Union
@@ -98,7 +98,7 @@ def decorate(target):
9898
log_level=giveup_log_level
9999
)
100100

101-
if asyncio.iscoroutinefunction(target):
101+
if inspect.iscoroutinefunction(target):
102102
retry = _async.retry_predicate
103103
else:
104104
retry = _sync.retry_predicate
@@ -198,7 +198,7 @@ def decorate(target):
198198
log_level=giveup_log_level,
199199
)
200200

201-
if asyncio.iscoroutinefunction(target):
201+
if inspect.iscoroutinefunction(target):
202202
retry = _async.retry_exception
203203
else:
204204
retry = _sync.retry_exception

0 commit comments

Comments
 (0)