diff --git a/tests/ebuild/test_build_dir_resolution.py b/tests/ebuild/test_build_dir_resolution.py index 28d9eb3..43f17e9 100644 --- a/tests/ebuild/test_build_dir_resolution.py +++ b/tests/ebuild/test_build_dir_resolution.py @@ -26,6 +26,7 @@ from __future__ import annotations import os +import shutil import subprocess import textwrap from pathlib import Path @@ -243,8 +244,8 @@ def test_configure_and_build_from_outside_agree_on_the_build_dir( @pytest.mark.skipif( - subprocess.run(["gcc", "--version"], capture_output=True).returncode != 0, - reason="needs a working gcc to link the executable", + shutil.which("gcc") is None, + reason="needs gcc on PATH to link the executable", ) def test_end_to_end_build_from_outside_produces_the_binary(tmp_path, monkeypatch): """No stubs: the real ninja run must produce the real executable.""" diff --git a/tests/unit/test_footprint.py b/tests/unit/test_footprint.py index 5450853..3e20168 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 @@ -55,8 +56,12 @@ def test_a_pure_bss_buffer_costs_ram_but_not_flash(self): assert fp.flash == 100 assert fp.ram == 8192 - class TestMeasure: + @pytest.mark.skipif( + shutil.which("gcc") is None or find_size_tool() is None, + reason="needs gcc and a size tool", + ) + def test_measures_a_real_binary(self, tmp_path): src = tmp_path / "m.c" src.write_text("static char buf[4096];\nint main(void){return buf[0];}\n")