service_report_generator module

Transform results and metadata from a pytest report JSON output and writes Service JSON reports.

Pytest Service JSON format:

{

‘name’: ‘pytest’, ‘tool_url’: ‘https://github.com/mozilla/frost’, ‘version’: 1, ‘created_at’: ‘2000-01-01 15:50:00.123123’, ‘meanings’: {

‘pass’: {

‘short’: ‘pass’, // text that _could_ be used in a badge ‘long’: ‘Test passed / no issues found.’

}, ‘warn’: {

‘short’: ‘warn’, ‘long’: ‘Expected test failures, either due to test-level xfail/xpass markers or exemptions.’

}, ‘fail’: {

‘short’: ‘fail’, ‘long’: ‘Critical test failure that should never happen e.g. publicly accessible DB snapshot,’

‘ user without MFA in prod.’

}, ‘err’: {

‘short’: ‘err’, ‘long’: ‘Error fetching an resource from AWS.’

}

}, ‘results’: [

{

‘test_name’: # unparametrized pytest test name ‘resource_name’: # best effort at resource name ‘name’: ‘status’: ‘value’: ‘reason’: # pytest test outcome reason if any (e.g. resource fetch failed) ‘markers’: # pytest markers on the test e.g. aws service, ruleset ‘metadata’: # additional metadata on the resource being tested ‘rationale’: # (optional) rationale behind the test. (null if not set) ‘description’: # (optional) description of the test (null if not set) ‘severity’: # (optional) severity of the test (null if not set) ‘regression’: # (optional) regression comment (null if not set)

]

}

service_report_generator.parse_args()[source]
service_report_generator.get_test_status(outcome)[source]
service_report_generator.get_resource_name(name)[source]
service_report_generator.get_result_for_test(test)[source]
service_report_generator.pytest_json_to_service_json(pytest_json)[source]