Closed
Description
#2062 added a test-sources
configuration, allowing projects to specify a directory of source code that would be copied into a test environment.
However, on macOS, a project with a test-sources
configuration will fail if a universal
build is requested. A universal build is built once, but is tested twice - once for each architecture that the build should support.
As the code to set up test-sources
is contained inside the loop testing architectures, the second test will fail if test-sources
references a directory, as the target directory will already exist.
The failure will look something like:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/Users/rkm/projects/cibuildwheel/cibuildwheel/__main__.py", line 487, in <module>
main()
File "/Users/rkm/projects/cibuildwheel/cibuildwheel/__main__.py", line 67, in main
main_inner(global_options)
File "/Users/rkm/projects/cibuildwheel/cibuildwheel/__main__.py", line 207, in main_inner
build_in_directory(args)
File "/Users/rkm/projects/cibuildwheel/cibuildwheel/__main__.py", line 408, in build_in_directory
platform_module.build(options, tmp_path)
File "/Users/rkm/projects/cibuildwheel/cibuildwheel/macos.py", line 730, in build
copy_test_sources(
File "/Users/rkm/projects/cibuildwheel/cibuildwheel/util/file.py", line 137, in copy_test_sources
copy_into(source, test_dir / test_path)
File "/Users/rkm/projects/cibuildwheel/cibuildwheel/util/file.py", line 110, in copy_into_local
shutil.copytree(src, dst)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/shutil.py", line 600, in copytree
return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/shutil.py", line 498, in _copytree
os.makedirs(dst, exist_ok=dirs_exist_ok)
File "<frozen os>", line 225, in makedirs
FileExistsError: [Errno 17] File exists: '/private/var/folders/b_/khqk71xd45d049kxc_59ltp80000gn/T/cibw-run-5t9ju11c/cp310-macosx_universal2/test_cwd/tests'
Metadata
Metadata
Assignees
Labels
No labels