diff --git a/cibuildwheel/pyodide.py b/cibuildwheel/pyodide.py index 3b721a10a..7309e79fa 100644 --- a/cibuildwheel/pyodide.py +++ b/cibuildwheel/pyodide.py @@ -21,6 +21,7 @@ BuildSelector, call, combine_constraints, + copy_test_sources, download, ensure_node, extract_zip, @@ -381,7 +382,15 @@ def build(options: Options, tmp_path: Path) -> None: test_cwd = identifier_tmp_dir / "test_cwd" test_cwd.mkdir(exist_ok=True) - (test_cwd / "test_fail.py").write_text(test_fail_cwd_file.read_text()) + if build_options.test_sources: + copy_test_sources( + build_options.test_sources, + build_options.package_dir, + test_cwd, + ) + else: + # There are no test sources. Copy the test safety file. + (test_cwd / "test_fail.py").write_text(test_fail_cwd_file.read_text()) shell(test_command_prepared, cwd=test_cwd, env=virtualenv_env)