|
8 | 8 | import pytest
|
9 | 9 | from pytest_pyodide import run_in_pyodide, spawn_web_server
|
10 | 10 |
|
11 |
| -sys.path.append(str(Path(__file__).resolve().parent / "src")) |
| 11 | +sys.path.append(str(Path(__file__).resolve().parent / "vendored")) |
12 | 12 |
|
13 | 13 | from importlib.metadata import Distribution, PackageNotFoundError
|
14 | 14 |
|
|
19 | 19 | except ImportError:
|
20 | 20 | pass
|
21 | 21 |
|
22 |
| -from pyodide_build import common |
| 22 | +EMSCRIPTEN_VER = "3.1.14" |
| 23 | + |
| 24 | + |
| 25 | +def _platform() -> str: |
| 26 | + # Vendored from pyodide_build.common |
| 27 | + version = EMSCRIPTEN_VER.replace(".", "_") |
| 28 | + return f"emscripten_{version}_wasm32" |
| 29 | + |
| 30 | + |
| 31 | +PLATFORM = _platform() |
23 | 32 |
|
24 | 33 | cpver = f"cp{sys.version_info.major}{sys.version_info.minor}"
|
25 | 34 |
|
26 | 35 |
|
27 | 36 | @pytest.fixture
|
28 | 37 | def mock_platform(monkeypatch):
|
29 |
| - monkeypatch.setenv("_PYTHON_HOST_PLATFORM", common.platform()) |
| 38 | + monkeypatch.setenv("_PYTHON_HOST_PLATFORM", _platform()) |
30 | 39 | from micropip import _micropip
|
31 | 40 |
|
32 |
| - monkeypatch.setattr(_micropip, "get_platform", common.platform) |
| 41 | + monkeypatch.setattr(_micropip, "get_platform", _platform) |
33 | 42 |
|
34 | 43 |
|
35 | 44 | def _mock_importlib_version(name: str) -> str:
|
@@ -82,7 +91,7 @@ def make_wheel_filename(name: str, version: str, platform: str = "generic") -> s
|
82 | 91 | if platform == "generic":
|
83 | 92 | platform_str = "py3-none-any"
|
84 | 93 | elif platform == "emscripten":
|
85 |
| - platform_str = f"{cpver}-{cpver}-{common.platform()}" |
| 94 | + platform_str = f"{cpver}-{cpver}-{_platform()}" |
86 | 95 | elif platform == "native":
|
87 | 96 | platform_str = f"{cpver}-{cpver}-manylinux_2_31_x86_64"
|
88 | 97 | else:
|
@@ -272,7 +281,7 @@ def test_parse_wheel_url3():
|
272 | 281 | def test_install_custom_url(selenium_standalone_micropip, base_url):
|
273 | 282 | selenium = selenium_standalone_micropip
|
274 | 283 |
|
275 |
| - with spawn_web_server(Path(__file__).parent / "test") as server: |
| 284 | + with spawn_web_server(Path(__file__).parent / "dist") as server: |
276 | 285 | server_hostname, server_port, _ = server
|
277 | 286 | base_url = f"http://{server_hostname}:{server_port}/"
|
278 | 287 | url = base_url + SNOWBALL_WHEEL
|
@@ -325,7 +334,7 @@ async def test_add_requirement():
|
325 | 334 | pytest.importorskip("packaging")
|
326 | 335 | from micropip._micropip import Transaction
|
327 | 336 |
|
328 |
| - with spawn_web_server(Path(__file__).parent / "test") as server: |
| 337 | + with spawn_web_server(Path(__file__).parent / "dist") as server: |
329 | 338 | server_hostname, server_port, _ = server
|
330 | 339 | base_url = f"http://{server_hostname}:{server_port}/"
|
331 | 340 | url = base_url + SNOWBALL_WHEEL
|
@@ -673,7 +682,7 @@ async def test_list_wheel_name_mismatch(mock_fetch: mock_fetch_cls) -> None:
|
673 | 682 |
|
674 | 683 |
|
675 | 684 | def test_list_load_package_from_url(selenium_standalone_micropip):
|
676 |
| - with spawn_web_server(Path(__file__).parent / "test") as server: |
| 685 | + with spawn_web_server(Path(__file__).parent / "dist") as server: |
677 | 686 | server_hostname, server_port, _ = server
|
678 | 687 | base_url = f"http://{server_hostname}:{server_port}/"
|
679 | 688 | url = base_url + SNOWBALL_WHEEL
|
@@ -808,7 +817,7 @@ async def test_freeze(mock_fetch: mock_fetch_cls) -> None:
|
808 | 817 |
|
809 | 818 |
|
810 | 819 | def test_emfs(selenium_standalone_micropip):
|
811 |
| - with spawn_web_server(Path(__file__).parent / "test") as server: |
| 820 | + with spawn_web_server(Path(__file__).parent / "dist") as server: |
812 | 821 | server_hostname, server_port, _ = server
|
813 | 822 | url = f"http://{server_hostname}:{server_port}/"
|
814 | 823 |
|
@@ -843,10 +852,6 @@ def raiseValueError(msg):
|
843 | 852 | return pytest.raises(ValueError, match=msg)
|
844 | 853 |
|
845 | 854 |
|
846 |
| -PLATFORM = common.platform() |
847 |
| -EMSCRIPTEN_VER = common.emscripten_version() |
848 |
| - |
849 |
| - |
850 | 855 | @pytest.mark.parametrize(
|
851 | 856 | "interp, abi, arch,ctx",
|
852 | 857 | [
|
|
0 commit comments