From 9b45cd5f27f1d6b9e9c8731e2b0419e5cadde6af Mon Sep 17 00:00:00 2001 From: John Mungandi Date: Sat, 18 Jul 2026 19:19:16 +0530 Subject: [PATCH] test: skip csv correctness check when pandas is absent --- .gitignore | 3 +++ tests/correctness.test.js | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7c818a20..2d755dec 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,6 @@ ponytail-*.gif # agentic benchmark workspaces (agent output, kept locally for inspection) benchmarks/agentic/runs/ + +# kbcode knowledge base (local agent context, not repo content) +kb/ diff --git a/tests/correctness.test.js b/tests/correctness.test.js index 7341f49a..f22cb234 100644 --- a/tests/correctness.test.js +++ b/tests/correctness.test.js @@ -5,8 +5,18 @@ const test = require('node:test'); const assert = require('node:assert/strict'); +const { execSync } = require('node:child_process'); const correctness = require('../benchmarks/correctness'); +// CSV checks need pandas installed locally; skip the pandas-dependent test when +// it's absent so `npm test` is green on a fresh clone without the optional dep. +let hasPandas = false; +try { + const probe = process.platform === 'win32' ? 'python -c "import pandas"' : 'python3 -c "import pandas"'; + execSync(probe, { stdio: 'pipe' }); + hasPandas = true; +} catch (_) {} + // Helper: wrap code in a fenced block and call the assertion with task vars. function check(task, lang, code) { const output = '```' + lang + '\n' + code + '\n```'; @@ -74,7 +84,7 @@ test('debounce: immediate-call implementation fails', () => { // --- CSV sum --- -test('csv: correct pandas one-liner passes', () => { +(hasPandas ? test : test.skip)('csv: correct pandas one-liner passes', () => { const result = check( "Write Python code that reads sales.csv and sums the 'amount' column.", 'python',