diff --git a/tests/ebuild/test_build_dir_resolution.py b/tests/ebuild/test_build_dir_resolution.py index 28d9eb3..0d889dc 100644 --- a/tests/ebuild/test_build_dir_resolution.py +++ b/tests/ebuild/test_build_dir_resolution.py @@ -27,6 +27,7 @@ import os import subprocess +import shutil import textwrap from pathlib import Path from types import SimpleNamespace @@ -243,7 +244,7 @@ def test_configure_and_build_from_outside_agree_on_the_build_dir( @pytest.mark.skipif( - subprocess.run(["gcc", "--version"], capture_output=True).returncode != 0, + shutil.which("gcc") is None, reason="needs a working gcc to link the executable", ) def test_end_to_end_build_from_outside_produces_the_binary(tmp_path, monkeypatch): diff --git a/tests/unit/test_footprint.py b/tests/unit/test_footprint.py index 5450853..55e998c 100644 --- a/tests/unit/test_footprint.py +++ b/tests/unit/test_footprint.py @@ -15,6 +15,7 @@ """ import os +import shutil import subprocess from pathlib import Path @@ -58,6 +59,9 @@ def test_a_pure_bss_buffer_costs_ram_but_not_flash(self): class TestMeasure: def test_measures_a_real_binary(self, tmp_path): + if shutil.which("gcc") is None: + pytest.skip("needs a working gcc to compile the test binary") + src = tmp_path / "m.c" src.write_text("static char buf[4096];\nint main(void){return buf[0];}\n") # gcc on Windows appends .exe when -o names no extension, so the