Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct Github Actions CI instability for iOS. #2337

Merged
merged 2 commits into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-13, macos-14]
os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-13, macos-15]
python_version: ['3.13']
include:
- os: ubuntu-latest
Expand Down
34 changes: 31 additions & 3 deletions bin/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,39 @@
if args.run_podman:
unit_test_args += ["--run-podman"]

print(
"\n\n================================== UNIT TESTS ==================================",
flush=True,
)
subprocess.run(unit_test_args, check=True)

# integration tests
# Run the serial integration tests without multiple processes
serial_integration_test_args = [
sys.executable,
"-m",
"pytest",
"-m",
"serial",
"-x",
"--durations",
"0",
"--timeout=2400",
"test",
"-vv",
]
print(
"\n\n=========================== SERIAL INTEGRATION TESTS ===========================",
flush=True,
)
subprocess.run(serial_integration_test_args, check=True)

# Non-serial integration tests
integration_test_args = [
sys.executable,
"-m",
"pytest",
"--dist",
"loadgroup",
"-m",
"not serial",
f"--numprocesses={args.num_processes}",
"-x",
"--durations",
Expand All @@ -55,4 +79,8 @@
if sys.platform.startswith("linux") and args.run_podman:
integration_test_args += ["--run-podman"]

print(
"\n\n========================= NON-SERIAL INTEGRATION TESTS =========================",
flush=True,
)
subprocess.run(integration_test_args, check=True)
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ junit_family = "xunit2"
xfail_strict = true
filterwarnings = ["error"]
log_cli_level = "info"

markers = [
"serial: tests that must *not* be run in parallel (deselect with '-m \"not serial\"')",
]

[tool.mypy]
python_version = "3.11"
Expand Down
9 changes: 9 additions & 0 deletions test/test_0_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
)


@pytest.mark.serial
def test_dummy_serial():
"""A no-op test to ensure that at least one serial test is always found.

Without this no-op test, CI fails on CircleCI because no serial tests are
found, and pytest errors if a test suite finds no tests.
"""


def test(tmp_path, build_frontend_env, capfd):
project_dir = tmp_path / "project"
basic_project.generate(project_dir)
Expand Down
13 changes: 8 additions & 5 deletions test/test_ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ def test_platform(self):
"""


# iOS tests shouldn't be run in parallel, because they're dependent on starting
# a simulator. It's *possible* to start multiple simulators, but not advisable
# to start as many simulators as there are CPUs on the test machine.
@pytest.mark.xdist_group(name="ios")
# iOS tests shouldn't be run in parallel, because they're dependent on calling
# Xcode, and starting a simulator. These are both multi-threaded operations, and
# it's easy to overload the CI machine if there are multiple test processes
# running multithreaded processes. Therefore, they're put in the serial group,
# which is guaranteed to run single-process.
@pytest.mark.serial
@pytest.mark.parametrize(
"build_config",
[
Expand All @@ -48,6 +50,7 @@ def test_ios_platforms(tmp_path, build_config):
"CIBW_BUILD": "cp313-*",
"CIBW_TEST_SOURCES": "tests",
"CIBW_TEST_COMMAND": "unittest discover tests test_platform.py",
"CIBW_BUILD_VERBOSITY": "1",
**build_config,
},
)
Expand All @@ -71,7 +74,7 @@ def test_ios_platforms(tmp_path, build_config):
assert set(actual_wheels) == expected_wheels


@pytest.mark.xdist_group(name="ios")
@pytest.mark.serial
def test_no_test_sources(tmp_path, capfd):
if utils.platform != "macos":
pytest.skip("this test can only run on macOS")
Expand Down
Loading