From 72d263930ad04fb48fb9d660c1e38a79c9675bf7 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 30 May 2025 16:41:37 -0400 Subject: [PATCH 1/2] fix: test-sources should use project dir Signed-off-by: Henry Schreiner --- cibuildwheel/platforms/ios.py | 2 +- cibuildwheel/platforms/linux.py | 2 +- cibuildwheel/platforms/macos.py | 2 +- cibuildwheel/platforms/pyodide.py | 2 +- cibuildwheel/platforms/windows.py | 2 +- cibuildwheel/util/file.py | 8 ++++---- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cibuildwheel/platforms/ios.py b/cibuildwheel/platforms/ios.py index 19ef04186..1a3d2d274 100644 --- a/cibuildwheel/platforms/ios.py +++ b/cibuildwheel/platforms/ios.py @@ -565,7 +565,7 @@ def build(options: Options, tmp_path: Path) -> None: if build_options.test_sources: copy_test_sources( build_options.test_sources, - build_options.package_dir, + Path.cwd(), testbed_app_path, ) else: diff --git a/cibuildwheel/platforms/linux.py b/cibuildwheel/platforms/linux.py index 00cd85b2f..82a695e69 100644 --- a/cibuildwheel/platforms/linux.py +++ b/cibuildwheel/platforms/linux.py @@ -403,7 +403,7 @@ def build_in_container( if build_options.test_sources: copy_test_sources( build_options.test_sources, - build_options.package_dir, + Path.cwd(), test_cwd, copy_into=container.copy_into, ) diff --git a/cibuildwheel/platforms/macos.py b/cibuildwheel/platforms/macos.py index 3b4534d2a..99ca915b8 100644 --- a/cibuildwheel/platforms/macos.py +++ b/cibuildwheel/platforms/macos.py @@ -712,7 +712,7 @@ def build(options: Options, tmp_path: Path) -> None: test_cwd.mkdir() copy_test_sources( build_options.test_sources, - build_options.package_dir, + Path.cwd(), test_cwd, ) else: diff --git a/cibuildwheel/platforms/pyodide.py b/cibuildwheel/platforms/pyodide.py index 920920923..4e545260f 100644 --- a/cibuildwheel/platforms/pyodide.py +++ b/cibuildwheel/platforms/pyodide.py @@ -527,7 +527,7 @@ def build(options: Options, tmp_path: Path) -> None: if build_options.test_sources: copy_test_sources( build_options.test_sources, - build_options.package_dir, + Path.cwd(), test_cwd, ) else: diff --git a/cibuildwheel/platforms/windows.py b/cibuildwheel/platforms/windows.py index 521695b60..c57a53de0 100644 --- a/cibuildwheel/platforms/windows.py +++ b/cibuildwheel/platforms/windows.py @@ -590,7 +590,7 @@ def build(options: Options, tmp_path: Path) -> None: if build_options.test_sources: copy_test_sources( build_options.test_sources, - build_options.package_dir, + Path.cwd(), test_cwd, ) else: diff --git a/cibuildwheel/util/file.py b/cibuildwheel/util/file.py index e38da01eb..c3e8c3065 100644 --- a/cibuildwheel/util/file.py +++ b/cibuildwheel/util/file.py @@ -111,21 +111,21 @@ def copy_into_local(src: Path, dst: PurePath) -> None: def copy_test_sources( test_sources: list[str], - package_dir: Path, + project_dir: Path, test_dir: PurePath, copy_into: Callable[[Path, PurePath], None] = copy_into_local, ) -> None: """Copy the list of test sources from the package to the test directory. - :param test_sources: A list of test paths, relative to the package_dir. - :param package_dir: The root of the package directory. + :param test_sources: A list of test paths, relative to the project_dir. + :param package_dir: The root of the project. :param test_dir: The folder where test sources should be placed. :param copy_info: The copy function to use. By default, does a local filesystem copy; but an OCIContainer.copy_info method (or equivalent) can be provided. """ for test_path in test_sources: - source = package_dir.resolve() / test_path + source = project_dir.resolve() / test_path if not source.exists(): msg = f"Test source {test_path} does not exist." From 305c17933c2c4fb34e055d976f3c8ef0821836a1 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Sat, 31 May 2025 15:32:59 -0400 Subject: [PATCH 2/2] docs: fix docstring Signed-off-by: Henry Schreiner --- cibuildwheel/util/file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cibuildwheel/util/file.py b/cibuildwheel/util/file.py index c3e8c3065..c0fdc2c19 100644 --- a/cibuildwheel/util/file.py +++ b/cibuildwheel/util/file.py @@ -118,9 +118,9 @@ def copy_test_sources( """Copy the list of test sources from the package to the test directory. :param test_sources: A list of test paths, relative to the project_dir. - :param package_dir: The root of the project. + :param project_dir: The root of the project. :param test_dir: The folder where test sources should be placed. - :param copy_info: The copy function to use. By default, does a local + :param copy_into: The copy function to use. By default, does a local filesystem copy; but an OCIContainer.copy_info method (or equivalent) can be provided. """