Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

test(health): guard Pascal-only tests that skip the shared _walk() helper (#1701)

Laentir Valetov1779579f0d28
diff --git a/tests/unit/health/test_complexity_walker.py b/tests/unit/health/test_complexity_walker.py
index 67ad7904d..ae1820da1 100644
--- a/tests/unit/health/test_complexity_walker.py
+++ b/tests/unit/health/test_complexity_walker.py
@@ -208,7 +208,11 @@ def test_pascal_no_class_metrics():
# Pascal method bodies live in a top-level ``defProc`` outside the
# ``declClass`` node (see languages.py's ``_PASCAL`` comment) -- class
# metrics are deliberately unmapped rather than emitting a misleading
- # zero-method class, same posture as Go.
+ # zero-method class, same posture as Go. Calls walk_file() directly
+ # (rather than through _walk_classes(), which skips on ``not
+ # fcx.classes`` -- exactly what this test asserts), so it needs its own
+ # best-effort guard rather than inheriting one from a helper.
+ pytest.importorskip("tree_sitter_pascal", reason="run `uv sync --all-packages`")
fcx = walk_file(
"unsupported.pas",
"pascal",
diff --git a/tests/unit/health/test_duplication.py b/tests/unit/health/test_duplication.py
index d57e0109f..c38ac3518 100644
--- a/tests/unit/health/test_duplication.py
+++ b/tests/unit/health/test_duplication.py
@@ -87,6 +87,10 @@ def test_tokenize_file_reads_tsx_with_the_jsx_grammar():
def test_tokenize_file_pascal_normalizes_identifiers_and_literals():
+ # Calls tokenize_file() directly with an inline byte literal, so it
+ # needs its own best-effort guard rather than inheriting one from a
+ # fixture-driven helper.
+ pytest.importorskip("tree_sitter_pascal", reason="run `uv sync --all-packages`")
source = (
b"unit U;\n interface\n implementation\n"
b" procedure Foo;\n begin\n WriteLn('hello', 42);\n end;\n end.\n"