fix: add pytest-json-report dependency and improve error handling

- Add pytest-json-report to requirements-test.txt for JSON test output
- Improve error handling in test runner service to catch JSONDecodeError
  and fallback to parsing stdout when JSON report is unavailable

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-12 23:07:35 +01:00
parent 213ff11c98
commit 6e3ae4bebb
2 changed files with 5 additions and 3 deletions

View File

@@ -96,14 +96,15 @@ class TestRunnerService:
report = json.load(f)
self._process_json_report(db, test_run, report)
except FileNotFoundError:
# Fallback to parsing stdout
except (FileNotFoundError, json.JSONDecodeError) as e:
# Fallback to parsing stdout if JSON report failed
logger.warning(f"JSON report unavailable ({e}), parsing stdout")
self._parse_pytest_output(test_run, result.stdout, result.stderr)
finally:
# Clean up temp file
try:
Path(json_report_path).unlink()
except:
except Exception:
pass
# Set final status