mirror of https://github.com/pyodide/pyodide.git
MAINT Use ordinary asyncio.gather in micropip tests (#2611)
This commit is contained in:
parent
693ee011c4
commit
a525c54d66
|
@ -6,23 +6,20 @@ if IN_BROWSER:
|
|||
WHEEL_BASE,
|
||||
fetch_bytes,
|
||||
fetch_string,
|
||||
gather,
|
||||
loadedPackages,
|
||||
pyodide_js,
|
||||
)
|
||||
else:
|
||||
from ._compat_not_in_pyodide import ( # type: ignore[no-redef]
|
||||
from ._compat_not_in_pyodide import (
|
||||
BUILTIN_PACKAGES,
|
||||
WHEEL_BASE,
|
||||
fetch_bytes,
|
||||
fetch_string,
|
||||
gather,
|
||||
loadedPackages,
|
||||
pyodide_js,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"gather",
|
||||
"fetch_bytes",
|
||||
"fetch_string",
|
||||
"WHEEL_BASE",
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from asyncio import gather
|
||||
from pathlib import Path
|
||||
|
||||
from pyodide._core import IN_BROWSER
|
||||
|
@ -31,7 +30,6 @@ async def fetch_string(url: str, kwargs: dict[str, str]) -> str:
|
|||
|
||||
|
||||
__all__ = [
|
||||
"gather",
|
||||
"fetch_bytes",
|
||||
"fetch_string",
|
||||
"WHEEL_BASE",
|
||||
|
|
|
@ -24,17 +24,6 @@ async def fetch_string(url: str, kwargs: dict[str, str]) -> str:
|
|||
return (await fetch_bytes(url, kwargs)).decode()
|
||||
|
||||
|
||||
# asyncio.gather will schedule any coroutines to run on the event loop but
|
||||
# we want to avoid using the event loop at all. Instead just run the
|
||||
# coroutines in sequence.
|
||||
# TODO: Use an asyncio testing framework to avoid this
|
||||
async def gather(*coroutines):
|
||||
result = []
|
||||
for coroutine in coroutines:
|
||||
result.append(await coroutine)
|
||||
return result
|
||||
|
||||
|
||||
class pyodide_js_:
|
||||
def __get__(self, attr):
|
||||
raise RuntimeError(f"Attempted to access property '{attr}' on pyodide_js dummy")
|
||||
|
@ -44,7 +33,6 @@ pyodide_js: Any = pyodide_js_()
|
|||
|
||||
|
||||
__all__ = [
|
||||
"gather",
|
||||
"fetch_bytes",
|
||||
"fetch_string",
|
||||
"WHEEL_BASE",
|
||||
|
|
|
@ -2,6 +2,7 @@ import asyncio
|
|||
import hashlib
|
||||
import importlib
|
||||
import json
|
||||
from asyncio import gather
|
||||
from dataclasses import dataclass, field
|
||||
from importlib.metadata import PackageNotFoundError
|
||||
from importlib.metadata import distributions as importlib_distributions
|
||||
|
@ -24,7 +25,6 @@ from ._compat import (
|
|||
WHEEL_BASE,
|
||||
fetch_bytes,
|
||||
fetch_string,
|
||||
gather,
|
||||
loadedPackages,
|
||||
pyodide_js,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue