Benchmark: pytest ajetaan Docker-kontissa (kipina-pytest)
Kontti hoitaa uv init + uv add + pytest eristetyssä ympäristössä. Python 3.14, ei VIRTUAL_ENV-ongelmia, täysi toistettavuus. Image: docker build -t kipina-pytest -f tests/Dockerfile.pytest tests/
This commit is contained in:
@@ -335,20 +335,18 @@ async function runPipeline(model, scenario) {
|
||||
result.validationIssues = issues.length;
|
||||
result.fixRounds = fixRound;
|
||||
|
||||
// 5. Projektin alustus (uv init) + kirjoita tiedostot + pytest
|
||||
console.log(` [5/5] Pytest...`);
|
||||
try {
|
||||
const uvPath = process.env.HOME + '/.local/bin/uv';
|
||||
const uv = existsSync(uvPath) ? uvPath : 'uv';
|
||||
execSync(`cd "${dir}" && ${uv} init --no-readme --python ">=3.14" 2>/dev/null && rm -f hello.py main.py`, { timeout: 30000, stdio: 'pipe' });
|
||||
execSync(`cd "${dir}" && ${uv} add fastapi "uvicorn[standard]" sqlalchemy pytest httpx 2>/dev/null`, { timeout: 60000, stdio: 'pipe' });
|
||||
// Kirjoita LLM:n generoimat Python-tiedostot
|
||||
for (const [fn, content] of Object.entries(files)) {
|
||||
if (fn.endsWith('.py')) writeFileSync(`${dir}/${fn}`, content);
|
||||
}
|
||||
|
||||
// Kirjoita LLM:n generoimat Python-tiedostot (uv initin jälkeen)
|
||||
for (const [fn, content] of Object.entries(files)) {
|
||||
if (fn.endsWith('.py')) writeFileSync(`${dir}/${fn}`, content);
|
||||
}
|
||||
execSync(`cd "${dir}" && rm -f app.db test.db`, { stdio: 'pipe' });
|
||||
const pytestOut = execSync(`cd "${dir}" && ${uv} run pytest test_main.py -v --tb=short 2>&1`, { timeout: 60000, encoding: 'utf-8' });
|
||||
// 5. Pytest Docker-kontissa (kipina-pytest image)
|
||||
console.log(` [5/5] Pytest (Docker)...`);
|
||||
try {
|
||||
const pytestOut = execSync(
|
||||
`docker run --rm -v "${dir}:/src:ro" kipina-pytest 2>&1`,
|
||||
{ timeout: 120000, encoding: 'utf-8' }
|
||||
);
|
||||
writeFileSync(`${dir}/_pytest.txt`, pytestOut);
|
||||
|
||||
const passedMatch = pytestOut.match(/(\d+) passed/);
|
||||
|
||||
Reference in New Issue
Block a user