kopia lustrzana https://github.com/simonw/datasette
Test against Python 3.8 in Travis (#623)
* Test against Python 3.8 in Travis * Avoid current_task warnings in Python 3.8pint-0.9
rodzic
28c4a6db5b
commit
1c063fae9d
|
@ -5,6 +5,7 @@ dist: xenial
|
|||
python:
|
||||
- "3.6"
|
||||
- "3.7"
|
||||
- "3.8"
|
||||
- "3.5"
|
||||
|
||||
# Executed for 3.5 AND 3.5 as the first "test" stage:
|
||||
|
|
|
@ -9,12 +9,19 @@ tracers = {}
|
|||
TRACE_RESERVED_KEYS = {"type", "start", "end", "duration_ms", "traceback"}
|
||||
|
||||
|
||||
# asyncio.current_task was introduced in Python 3.7:
|
||||
for obj in (asyncio, asyncio.Task):
|
||||
current_task = getattr(obj, "current_task", None)
|
||||
if current_task is not None:
|
||||
break
|
||||
|
||||
|
||||
def get_task_id():
|
||||
try:
|
||||
loop = asyncio.get_event_loop()
|
||||
except RuntimeError:
|
||||
return None
|
||||
return id(asyncio.Task.current_task(loop=loop))
|
||||
return id(current_task(loop=loop))
|
||||
|
||||
|
||||
@contextmanager
|
||||
|
|
Ładowanie…
Reference in New Issue