Skip to content

Commit 4373527

Browse files
committed
test: check node & test on macos arm64
1 parent 9239f25 commit 4373527

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

test/test_emscripten.py

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,44 @@
11
from __future__ import annotations
22

3-
import platform
43
import shutil
4+
import sys
55
import textwrap
66

77
import pytest
88

9+
from cibuildwheel.util import CIBW_CACHE_PATH
10+
911
from . import test_projects, utils
1012

1113
basic_project = test_projects.new_c_project()
14+
basic_project.files["check_node.py"] = r"""
15+
import sys
16+
import shutil
17+
from pathlib import Path
18+
from pyodide.code import run_js
19+
20+
21+
def check_node():
22+
node = shutil.which("node")
23+
assert node is not None, "node is None"
24+
node_path = Path(node).resolve(strict=True)
25+
cibw_cache_path = Path(sys.argv[1]).resolve(strict=True)
26+
assert cibw_cache_path in node_path.parents, f"{cibw_cache_path} not a parent of {node_path}"
27+
node_js = run_js("globalThis.process.execPath")
28+
assert node_js is not None, "node_js is None"
29+
node_js_path = Path(node_js).resolve(strict=True)
30+
assert node_js_path == node_path, f"{node_js_path} != {node_path}"
31+
32+
33+
if __name__ == "__main__":
34+
check_node()
35+
"""
1236

1337

1438
@pytest.mark.parametrize("use_pyproject_toml", [True, False])
1539
def test_pyodide_build(tmp_path, use_pyproject_toml):
16-
if platform.machine() == "arm64":
17-
pytest.skip("emsdk doesn't work correctly on arm64")
40+
if sys.platform == "win32":
41+
pytest.skip("emsdk doesn't work correctly on Windows")
1842

1943
if not shutil.which("python3.12"):
2044
pytest.skip("Python 3.12 not installed")
@@ -31,10 +55,16 @@ def test_pyodide_build(tmp_path, use_pyproject_toml):
3155
project_dir = tmp_path / "project"
3256
basic_project.generate(project_dir)
3357

58+
# check for node in 1 case only to reduce CI load
59+
add_env = {}
60+
if use_pyproject_toml:
61+
add_env["CIBW_TEST_COMMAND"] = f"python {{project}}/check_node.py {CIBW_CACHE_PATH}"
62+
3463
# build the wheels
3564
actual_wheels = utils.cibuildwheel_run(
3665
project_dir,
3766
add_args=["--platform", "pyodide"],
67+
add_env=add_env,
3868
)
3969

4070
# check that the expected wheels are produced

0 commit comments

Comments
 (0)