MCPcopy Create free account
hub / github.com/promptfoo/promptfoo / readPythonTestCases

Function readPythonTestCases

src/util/testCaseReader.ts:290–301  ·  view source on GitHub ↗
(
  pathWithoutFunction: string,
  maybeFunctionName: string | undefined,
  finalConfig: Record<string, any> | undefined,
)

Source from the content-addressed store, hash-verified

288}
289
290async function readPythonTestCases(
291 pathWithoutFunction: string,
292 maybeFunctionName: string | undefined,
293 finalConfig: Record<string, any> | undefined,
294): Promise<TestCase[]> {
295 const args = finalConfig === undefined ? [] : [finalConfig];
296 const result = await runPython(pathWithoutFunction, maybeFunctionName ?? 'generate_tests', args);
297 if (!Array.isArray(result)) {
298 throw new Error(`Python test function must return a list of test cases, got ${typeof result}`);
299 }
300 return result;
301}
302
303function parseLocalCsv(fileContent: string, delimiter: string, relaxQuotes: boolean): CsvRow[] {
304 return parseCsv(fileContent, {

Callers 1

Calls 1

runPythonFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…