
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
pytest-xray-reporter
Advanced tools
A pytest plugin that generates Xray JSON reports for test results.
pip install pytest-xray-reporter
The plugin can be used with pytest to generate Xray JSON reports. It supports various command line options to configure the report generation.
pytest --xray-output=xray-report.json
--xray-output
: Output file for Xray JSON report (default: "xray-report.json")--xray-project
: Xray project key--xray-test-plan
: Xray test plan key--xray-test-execution
: Xray test execution key--xray-test-key
: Xray test key to use for all tests (if not provided, uses test function name and logs a warning)# Using a specific test key
pytest --xray-output=xray-report.json \
--xray-project=PROJ \
--xray-test-plan=PROJ-123 \
--xray-test-execution=PROJ-456 \
--xray-test-key=PROJ-789
# Using test function names as test keys (will show a warning)
pytest --xray-output=xray-report.json \
--xray-project=PROJ \
--xray-test-plan=PROJ-123 \
--xray-test-execution=PROJ-456
The plugin generates a JSON report in the following format:
{
"tests": [
{
"testKey": "PROJ-789", // Or test function name if --xray-test-key is not provided
"start": "2024-03-21T10:00:00+00:00",
"finish": "2024-03-21T10:00:01+00:00",
"status": "PASSED",
"comment": "",
"evidence": [
{
"data": "base64_encoded_data",
"filename": "stdout.txt",
"contentType": "text/plain"
}
],
"customFields": [
{
"id": "test_path",
"name": "Test Path",
"value": "test_file.py::test_function"
}
]
}
],
"info": {
"summary": {
"total": 1,
"passed": 1,
"failed": 0,
"errors": 0,
"skipped": 0,
"duration": 1.0
},
"testEnvironments": [
"Linux",
"5.4.0",
"Python 3.9.0"
],
"project": "PROJ",
"testPlanKey": "PROJ-123",
"testExecutionKey": "PROJ-456"
}
}
The plugin maps pytest outcomes to Xray statuses:
passed
→ PASSED
failed
→ FAILED
error
→ ERROR
skipped
→ SKIPPED
UNKNOWN
The plugin automatically includes the following custom fields:
test_path
: The full path to the test functionContributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Pytest plugin for generating Xray JSON reports
We found that pytest-xray-reporter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.