From dbfa7e66e1adf8f8ac0f9f4fe25ee47614fdcb0e Mon Sep 17 00:00:00 2001 From: Leynos Date: Mon, 22 Sep 2025 19:49:31 +0100 Subject: [PATCH 1/4] Expand pyproject skip list handling --- .../scripts/validate_toml_versions.py | 3 +++ .../tests/test_validate_toml_versions.py | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/actions/release-to-pypi-uv/scripts/validate_toml_versions.py b/.github/actions/release-to-pypi-uv/scripts/validate_toml_versions.py index 5dfbaccb..d3838ae4 100644 --- a/.github/actions/release-to-pypi-uv/scripts/validate_toml_versions.py +++ b/.github/actions/release-to-pypi-uv/scripts/validate_toml_versions.py @@ -28,6 +28,9 @@ "build", ".direnv", ".mypy_cache", + ".pytest_cache", + ".cache", + "htmlcov", } TRUTHY_STRINGS = {"true", "1", "yes", "y", "on"} diff --git a/.github/actions/release-to-pypi-uv/tests/test_validate_toml_versions.py b/.github/actions/release-to-pypi-uv/tests/test_validate_toml_versions.py index d0dbb8a7..107af4f2 100644 --- a/.github/actions/release-to-pypi-uv/tests/test_validate_toml_versions.py +++ b/.github/actions/release-to-pypi-uv/tests/test_validate_toml_versions.py @@ -213,15 +213,17 @@ def test_skips_files_in_ignored_directories( capsys: pytest.CaptureFixture[str], ) -> None: """Warn and exit when only ignored directories match the pattern.""" - ignored = project_root / ".venv" / "pkg" - _write_pyproject( - ignored, - """ + skip_dirs = {".venv", ".mypy_cache", ".pytest_cache", ".cache", "htmlcov"} + assert skip_dirs <= module.SKIP_PARTS + for name in skip_dirs: + _write_pyproject( + project_root / name / "pkg", + """ [project] name = "ignored" version = "9.9.9" """, - ) + ) _invoke_main(module, version="1.0.0") captured = capsys.readouterr() assert "::warning::No TOML files matched pattern" in captured.out From 0329bae21b9d654d0f0a831f1cb49238a5f31e0c Mon Sep 17 00:00:00 2001 From: Leynos Date: Mon, 22 Sep 2025 19:59:31 +0100 Subject: [PATCH 2/4] Strengthen TOML and runtime timeout tests --- .../release-to-pypi-uv/tests/test_validate_toml_versions.py | 3 +++ .../actions/rust-build-release/tests/test_target_install.py | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/.github/actions/release-to-pypi-uv/tests/test_validate_toml_versions.py b/.github/actions/release-to-pypi-uv/tests/test_validate_toml_versions.py index 107af4f2..e8096b3a 100644 --- a/.github/actions/release-to-pypi-uv/tests/test_validate_toml_versions.py +++ b/.github/actions/release-to-pypi-uv/tests/test_validate_toml_versions.py @@ -224,6 +224,9 @@ def test_skips_files_in_ignored_directories( version = "9.9.9" """, ) + discovered = list(module._iter_files("**/pyproject.toml")) + assert not discovered + _invoke_main(module, version="1.0.0") captured = capsys.readouterr() assert "::warning::No TOML files matched pattern" in captured.out diff --git a/.github/actions/rust-build-release/tests/test_target_install.py b/.github/actions/rust-build-release/tests/test_target_install.py index 046f22c8..c3757c79 100644 --- a/.github/actions/rust-build-release/tests/test_target_install.py +++ b/.github/actions/rust-build-release/tests/test_target_install.py @@ -433,8 +433,14 @@ def timeout_runtime(_name: str, *, cwd: object | None = None) -> bool: "::warning::podman runtime probe timed out after 10s; " "treating runtime as unavailable" ) + expected_toolchain = ( + f"::error:: toolchain '{default_toolchain}-x86_64-unknown-linux-gnu' " + "does not support target 'thumbv7em-none-eabihf'" + ) assert expected_docker in err assert expected_podman in err + assert expected_toolchain in err + assert "TimeoutExpired" not in err def test_configure_windows_linkers_prefers_toolchain_gcc( From 586a2e10e880f4ca6b7f44dbc0d030a6ebef62be Mon Sep 17 00:00:00 2001 From: Leynos Date: Tue, 23 Sep 2025 06:52:00 +0100 Subject: [PATCH 3/4] Assert cargo fallback logs podman failure --- .../rust-build-release/tests/test_target_install.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/actions/rust-build-release/tests/test_target_install.py b/.github/actions/rust-build-release/tests/test_target_install.py index c3757c79..00cc6f5b 100644 --- a/.github/actions/rust-build-release/tests/test_target_install.py +++ b/.github/actions/rust-build-release/tests/test_target_install.py @@ -152,6 +152,7 @@ def test_falls_back_to_cargo_when_podman_unusable( runtime_module: ModuleType, module_harness: HarnessFactory, cmd_mox: CmdMox, + capsys: pytest.CaptureFixture[str], ) -> None: """Fallback to cargo when podman runtime detection fails quickly (issue #97).""" cross_env = module_harness(cross_module) @@ -184,6 +185,12 @@ def fake_which(name: str) -> str | None: assert any(cmd[0] == "cargo" for cmd in app_env.calls) assert all(cmd[0] != "cross" for cmd in app_env.calls) + captured = capsys.readouterr() + assert ( + "cross (0.2.5) requires a container runtime; " + "using cargo (docker=False, podman=False)" in captured.out + ) + assert "TimeoutExpired" not in captured.err @pytest.mark.parametrize( From f9dbd878360c60832200a895a885cd2599c8478b Mon Sep 17 00:00:00 2001 From: Leynos Date: Tue, 23 Sep 2025 06:52:05 +0100 Subject: [PATCH 4/4] Parameterize skip-directory regression --- .../tests/test_validate_toml_versions.py | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/actions/release-to-pypi-uv/tests/test_validate_toml_versions.py b/.github/actions/release-to-pypi-uv/tests/test_validate_toml_versions.py index e8096b3a..5323966f 100644 --- a/.github/actions/release-to-pypi-uv/tests/test_validate_toml_versions.py +++ b/.github/actions/release-to-pypi-uv/tests/test_validate_toml_versions.py @@ -13,6 +13,8 @@ from ._helpers import load_script_module +SKIP_PARTS = tuple(sorted(load_script_module("validate_toml_versions").SKIP_PARTS)) + @pytest.fixture(name="module") def fixture_module() -> ModuleType: @@ -207,23 +209,24 @@ def test_dynamic_version_allowed_for_falsey_variants( assert "uses dynamic 'version'" in captured.out -def test_skips_files_in_ignored_directories( +@pytest.mark.parametrize("skip_part", SKIP_PARTS, ids=lambda part: part) +def test_skips_files_in_ignored_directory( project_root: Path, module: ModuleType, capsys: pytest.CaptureFixture[str], + skip_part: str, ) -> None: - """Warn and exit when only ignored directories match the pattern.""" - skip_dirs = {".venv", ".mypy_cache", ".pytest_cache", ".cache", "htmlcov"} - assert skip_dirs <= module.SKIP_PARTS - for name in skip_dirs: - _write_pyproject( - project_root / name / "pkg", - """ + """Warn and exit when only a single ignored directory matches the pattern.""" + assert skip_part in module.SKIP_PARTS + _write_pyproject( + project_root / skip_part / "pkg", + """ [project] name = "ignored" version = "9.9.9" """, - ) + ) + discovered = list(module._iter_files("**/pyproject.toml")) assert not discovered