Skip to content

Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.

feat(core): add Python group to TEST_PATTERN_GROUPS with pytest patterns

thejesh14b3560a0d6e
diff --git a/understand-anything-plugin/packages/core/src/__tests__/ignore-generator.test.ts b/understand-anything-plugin/packages/core/src/__tests__/ignore-generator.test.ts
index dccee70f..12269ffa 100644
--- a/understand-anything-plugin/packages/core/src/__tests__/ignore-generator.test.ts
+++ b/understand-anything-plugin/packages/core/src/__tests__/ignore-generator.test.ts
@@ -208,23 +208,34 @@ describe("generateStarterIgnoreFile", () => {
expect(content).toContain("# **/*Benchmark.cpp");
});
+ it("includes Python pytest / unittest file patterns", () => {
+ const content = generateStarterIgnoreFile(testDir);
+ expect(content).toContain("# Python");
+ // pytest / unittest default discovery — file must start with test_.
+ expect(content).toContain("# **/test_*.py");
+ // Alternate convention used by tensorflow, google-style, etc.
+ expect(content).toContain("# **/*_test.py");
+ });
+
it("groups patterns under the JS / TS sub-header", () => {
const content = generateStarterIgnoreFile(testDir);
expect(content).toContain("# JS / TS");
});
- it("emits language groups in stable order: JS, C#, Java, Go, C++", () => {
+ it("emits language groups in stable order: JS, C#, Java, Go, C++, Python", () => {
const content = generateStarterIgnoreFile(testDir);
const jsIdx = content.indexOf("# JS / TS");
const csIdx = content.indexOf("# C# / .NET");
const javaIdx = content.indexOf("# Java / Kotlin");
const goIdx = content.indexOf("# Go");
const cppIdx = content.indexOf("# C++");
+ const pyIdx = content.indexOf("# Python");
expect(jsIdx).toBeGreaterThan(-1);
expect(csIdx).toBeGreaterThan(jsIdx);
expect(javaIdx).toBeGreaterThan(csIdx);
expect(goIdx).toBeGreaterThan(javaIdx);
expect(cppIdx).toBeGreaterThan(goIdx);
+ expect(pyIdx).toBeGreaterThan(cppIdx);
});
it("keeps all suggestions commented even with no detected dirs and no .gitignore", () => {
diff --git a/understand-anything-plugin/packages/core/src/ignore-generator.ts b/understand-anything-plugin/packages/core/src/ignore-generator.ts
index 3e9a1ccc..82ec9764 100644
--- a/understand-anything-plugin/packages/core/src/ignore-generator.ts
+++ b/understand-anything-plugin/packages/core/src/ignore-generator.ts
@@ -94,6 +94,17 @@ const TEST_PATTERN_GROUPS: Array<{ label: string; patterns: string[] }> = [
"**/*Benchmark.cpp",
],
},
+ {
+ // pytest / unittest discovery is filename-based, so large Python
+ // codebases (pandas, numpy, scikit-learn, tensorflow) commonly ship
+ // test_*.py or *_test.py files co-located with the module under test
+ // rather than clustered in a single tests/ tree.
+ label: "Python",
+ patterns: [
+ "**/test_*.py",
+ "**/*_test.py",
+ ],
+ },
];
/**