1
1
from __future__ import annotations
2
2
3
- import platform
4
3
import shutil
4
+ import sys
5
5
import textwrap
6
6
7
7
import pytest
8
8
9
+ from cibuildwheel .util import CIBW_CACHE_PATH
10
+
9
11
from . import test_projects , utils
10
12
11
13
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
+ """
12
36
13
37
14
38
@pytest .mark .parametrize ("use_pyproject_toml" , [True , False ])
15
39
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 " )
18
42
19
43
if not shutil .which ("python3.12" ):
20
44
pytest .skip ("Python 3.12 not installed" )
@@ -31,10 +55,16 @@ def test_pyodide_build(tmp_path, use_pyproject_toml):
31
55
project_dir = tmp_path / "project"
32
56
basic_project .generate (project_dir )
33
57
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
+
34
63
# build the wheels
35
64
actual_wheels = utils .cibuildwheel_run (
36
65
project_dir ,
37
66
add_args = ["--platform" , "pyodide" ],
67
+ add_env = add_env ,
38
68
)
39
69
40
70
# check that the expected wheels are produced
0 commit comments