Correct handling of test_sources on universal macOS builds. (#2284)

* Correct handling of test_sources on universal macOS builds.

* Make the test sources modifications macOS only.

* Don't use unittest discovery - that needs an actual test.

* Add comment explaining test source creation

Co-authored-by: Joe Rickerby <joerick@mac.com>

* Simplify dict usage.

---------

Co-authored-by: Joe Rickerby <joerick@mac.com>
This commit is contained in:
Russell Keith-Magee
2025-02-26 09:13:09 +00:00
committed by GitHub
co-authored by Joe Rickerby
parent 7e5810c550
commit 4d37797aa6
2 changed files with 30 additions and 8 deletions
+9 -6
View File
@@ -717,12 +717,15 @@ def build(options: Options, tmp_path: Path) -> None:
if build_options.test_sources:
test_cwd = identifier_tmp_dir / "test_cwd"
test_cwd.mkdir(exist_ok=True)
copy_test_sources(
build_options.test_sources,
build_options.package_dir,
test_cwd,
)
# only create test_cwd if it doesn't already exist - it
# may have been created during a previous `testing_arch`
if not test_cwd.exists():
test_cwd.mkdir()
copy_test_sources(
build_options.test_sources,
build_options.package_dir,
test_cwd,
)
else:
# There are no test sources. Run the tests in the project directory.
test_cwd = Path(".").resolve()