Skip to content

Commit 046453f

Browse files
committed
fix(dep-graph): use language-aware test filtering
Use lang_parser's language-specific test-file rules for supported source files during dependency-graph build filtering, while preserving the legacy test-ish filter for non-source files. This prevents valid non-Python sources such as Go testdata fixtures or TypeScript test helper modules from being excluded before parse-time filtering can see them. Add regression coverage for Go testdata, non-Python helper source files, language-specific test files, and legacy non-source test-ish exclusions.
1 parent 1fd2ee2 commit 046453f

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

CoderMind/scripts/rpg/dep_graph.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ def _exclude_irrelevant_for_build(file_id: str) -> bool:
9393
if path_obj.name.startswith("."):
9494
return False
9595

96-
if is_test_file(file_id):
96+
if lang_parser.is_supported_source(file_id):
97+
if lang_parser.is_test_file(file_id):
98+
return False
99+
elif is_test_file(file_id):
97100
return False
98101

99102
return True

CoderMind/tests/test_dep_graph.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,19 @@ def test_pyproject_excluded(self):
239239
def test_node_modules_excluded(self):
240240
assert _exclude_irrelevant_for_build("node_modules/package/index.js") is False
241241

242+
def test_go_testdata_source_included(self):
243+
assert _exclude_irrelevant_for_build("pkg/testdata/fixtures.go") is True
244+
245+
def test_non_python_test_helper_source_included_when_language_rule_allows(self):
246+
assert _exclude_irrelevant_for_build("src/test_helpers.ts") is True
247+
248+
def test_language_test_source_excluded(self):
249+
assert _exclude_irrelevant_for_build("pkg/foo_test.go") is False
250+
assert _exclude_irrelevant_for_build("src/client.test.ts") is False
251+
252+
def test_non_source_testish_file_keeps_legacy_exclusion(self):
253+
assert _exclude_irrelevant_for_build("data/test_fixture.json") is False
254+
242255

243256
class TestExcludeIrrelevantForParse:
244257
def test_python_file_included(self):

0 commit comments

Comments
 (0)