Rework fetch_bytes and _fetch_pypi_json patches to make testing easier. Various improvements to test_micropip. The main feature is a new fixture
'mock_fetch' with an add_pkg method that takes a package name, a map
from version to requirements, and a choice of platform. This should
hopefully make writing more tests a lot easier (which is good because
we could use more micropip test coverage but we are limited by the
difficulty of writing good tests).

This also adds a fixture to create distinct dummy package names and
enables @pytest.mark.asyncio to handle the async calls rather than
using `asyncio.get_event_loop.run_until_complete`.
import sys

IN_BROWSER = "_pyodide_core" in sys.modules

if IN_BROWSER:
    from _pyodide_core import (
        ConversionError,
        JsException,
        JsProxy,
        create_once_callable,
        create_proxy,
        destroy_proxies,
        to_js,
    )
else:
    from _pyodide._core_docs import (
        ConversionError,
        JsException,
        JsProxy,
        create_once_callable,
        create_proxy,
        destroy_proxies,
        to_js,
    )


__all__ = [
    "JsProxy",
    "JsException",
    "create_proxy",
    "create_once_callable",
    "to_js",
    "ConversionError",
    "destroy_proxies",
]

import sys

IN_BROWSER = "_pyodide_core" in sys.modules

if IN_BROWSER:
    from _pyodide_core import (
        ConversionError,
        JsException,
        JsProxy,
        create_once_callable,
        create_proxy,
        destroy_proxies,
        to_js,
    )
else:
    from _pyodide._core_docs import (
        ConversionError,
        JsException,
        JsProxy,
        create_once_callable,
        create_proxy,
        destroy_proxies,
        to_js,
    )


__all__ = [
    "JsProxy",
    "JsException",
    "create_proxy",
    "create_once_callable",
    "to_js",
    "ConversionError",
    "destroy_proxies",
]
