feat: add configuration option for test executor arguments (#2636)

* Add test-execution-args option.

* Add usage of test-execution-args.

* Add CI configuration to use test-execution-args.

* Document the test-execution-args setting.

* Simplify code using or syntax instead of inline if.

Co-authored-by: Malcolm Smith <smith@chaquo.com>

* Clarified some Android-specific terminology, and added details about the default args to the test runner.

* Switch to a dict-based test-execution configuration

* Add tests for test-execution parsing.

* Add all the files before pushing...

* Add note about default Android version for testbed.

* Improve description of test-execution setting.

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

* Switch to using test-runtime.

---------

Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Joe Rickerby <joerick@mac.com>
This commit is contained in:
Russell Keith-Magee
2025-11-05 16:19:41 -05:00
committed by GitHub
co-authored by Malcolm Smith Joe Rickerby
parent c53e541c2d
commit 4fe7630d9c
11 changed files with 231 additions and 8 deletions
+34
View File
@@ -2,6 +2,7 @@ import os
import platform as platform_module
import textwrap
import unittest.mock
from collections.abc import Sequence
from pathlib import Path
from typing import Literal
@@ -626,6 +627,39 @@ def test_get_build_frontend_extra_flags_warning(
mock_warning.assert_called_once()
@pytest.mark.parametrize(
("definition", "expected_args"),
[
("", ()),
('test-runtime = ""', ()),
("test-runtime = {}", ()),
('test-runtime = {args = ""}', []),
('test-runtime = "args: --simulator foo"', ["--simulator", "foo"]),
('test-runtime = {args = ["--simulator", "foo"]}', ["--simulator", "foo"]),
],
)
def test_test_runtime_handling(
tmp_path: Path, definition: str, expected_args: Sequence[str] | None
) -> None:
args = CommandLineArguments.defaults()
args.package_dir = tmp_path
pyproject_toml: Path = tmp_path / "pyproject.toml"
pyproject_toml.write_text(
textwrap.dedent(
f"""\
[tool.cibuildwheel]
{definition}
"""
)
)
options = Options(platform="ios", command_line_arguments=args, env={})
local = options.build_options("cp313-ios_13_0_arm64_iphoneos")
assert local.test_runtime.args == expected_args
@pytest.mark.parametrize(
("definition", "expected"),
[