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:
@@ -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
|
||||
|
||||
@@ -4,6 +4,7 @@ pytest>=8.3.4
|
||||
pytest-cov>=6.0.0
|
||||
pytest-asyncio>=0.24.0
|
||||
pytest-mock>=3.14.0
|
||||
pytest-json-report>=1.5.0
|
||||
httpx>=0.28.1
|
||||
faker>=33.1.0
|
||||
pytest-repeat>=0.9.4
|
||||
|
||||
Reference in New Issue
Block a user