Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"build",
".direnv",
".mypy_cache",
".pytest_cache",
".cache",
"htmlcov",
}

TRUTHY_STRINGS = {"true", "1", "yes", "y", "on"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -207,21 +209,27 @@ 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."""
ignored = project_root / ".venv" / "pkg"
"""Warn and exit when only a single ignored directory matches the pattern."""
assert skip_part in module.SKIP_PARTS
_write_pyproject(
ignored,
project_root / skip_part / "pkg",
"""
[project]
name = "ignored"
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
Expand Down
13 changes: 13 additions & 0 deletions .github/actions/rust-build-release/tests/test_target_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -433,8 +440,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(
Expand Down
Loading