parse test results to inform requirements
Project description
testreqstatus
pip install testreqstatus
Usage
-
Establish a set of requirements corresponding to test names:
{ "DMS356": [ "romancal.regtest.test_mos_pipeline.test_level3_mos_pipeline" ], "DMS373": [ "romancal.regtest.test_mos_pipeline.test_hlp_mosaic_pipeline" ], "DMS374": [ "romancal.regtest.test_mos_pipeline.test_level3_mos_pipeline" ], "DMS400": [ "romancal.regtest.test_mos_pipeline.test_level3_mos_pipeline" ] }
[!TIP] To extract test requirements from existing tests decorated with
@metrics_logger
, useRequirementTests.from_test_directory()
:from testreqstatus import RequirementTests requirements = RequirementTests.from_test_directory("~/projects/romancal/")
-
Run tests and generate a JUnitXML results file:
<?xml version="1.0" encoding="utf-8"?> <testsuites> <testsuite name="pytest" errors="0" failures="0" skipped="0" tests="2" time="2021.550" timestamp="2024-08-23T00:23:01.454354" hostname="spacetelescope-runner-2ls89-rrbf2"> <testcase classname="romancal.regtest.test_mos_pipeline" name="test_level3_mos_pipeline" time="677.728"> </testcase> <testcase classname="romancal.regtest.test_mos_pipeline" name="test_hlp_mosaic_pipeline" time="486.642"> </testcase> </testsuite> </testsuites>
-
Use
RequirementTestResults.requirements_by_test_result
to retrieve the status of each test and its corresponding requirements:from testreqstatus import RequirementTestResults results = RequirementTestResults( test_requirements="examples/test_requirements.json", test_results="examples/results.xml", ) print(results.requirements_by_test_result)
{ "romancal.regtest.test_mos_pipeline.test_level3_mos_pipeline": { "status": "PASS", "requirements": [ "DMS356", "DMS374", "DMS400" ] }, "romancal.regtest.test_mos_pipeline.test_hlp_mosaic_pipeline": { "status": "PASS", "requirements": [ "DMS373" ] } }
[!TIP] You can alternatively use
RequirementTestResults.test_results_by_requirement
to obtain the inverse mapping (requirements and their corresponding test statuses):print(results.test_results_by_requirement){ "DMS356": { "romancal.regtest.test_mos_pipeline.test_level3_mos_pipeline": "PASS" }, "DMS373": { "romancal.regtest.test_mos_pipeline.test_hlp_mosaic_pipeline": "PASS" }, "DMS374": { "romancal.regtest.test_mos_pipeline.test_level3_mos_pipeline": "PASS" }, "DMS400": { "romancal.regtest.test_mos_pipeline.test_level3_mos_pipeline": "PASS" } }
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file testreqstatus-0.4.0.tar.gz
.
File metadata
- Download URL: testreqstatus-0.4.0.tar.gz
- Upload date:
- Size: 286.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c9d2dd5770d1d87a523a8cffeee6edbffbda38e2a5acedbf148b82d497cb0e8 |
|
MD5 | 979d498746e3340879d45ee7641acc0a |
|
BLAKE2b-256 | 890772c68db4d30bf1a6b76d8e10610a5459b2776ebe2ed172fecf1710ed2d62 |
File details
Details for the file testreqstatus-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: testreqstatus-0.4.0-py3-none-any.whl
- Upload date:
- Size: 29.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3f5284a2f86411d7a47681be14eccc5d2ed1fbf710344fee5b921a8489ff5d7 |
|
MD5 | 5ea80e180e1411ef616cf6a68dea8605 |
|
BLAKE2b-256 | 6f9820f66feb9f73e0f341ad49a4d93e8ba399ce273de599f4d414da337d296a |