How to use _generate_details_block method in localstack

Best Python code snippet using localstack_python

metric_aggregator.py

Source:metric_aggregator.py Github

copy

Full Screen

...70 output += f"<p><details><summary>{operation_tested/operation_counter*100:.2f}% test coverage</summary>\n\n{tmp}\n</details></p>\n"71 with open(file_name, "a") as fd:72 fd.write(f"{output}\n")73 output = ""74def _generate_details_block(details_title: str, details: dict) -> str:75 output = f" <details><summary>{details_title}</summary>\n\n"76 for e, count in details.items():77 if count > 0:78 output += f" {template_implemented_item}{e}\n"79 else:80 output += f" {template_not_implemented_item}{e}\n"81 output += " </details>\n"82 return output83def create_readable_report(file_name: str, metrics: dict):84 output = "# Metric Collection Report of Integration Tests #\n\n"85 output += "**__Disclaimer__**: naive calculation of test coverage - if operation is called at least once, it is considered as 'covered'.\n"86 output += f"{AWS_VALIDATED}: aws_validated or using the snapshot fixture\n"87 output += f"{SNAPSHOT}: using the snapshot fixture without any skip_snapshot_verify\n"88 output += f"{AWS_VALIDATED}: using the snapshot fixture but uses skip_snapshot_verify\n"89 for service in sorted(metrics.keys()):90 output += f"## {service} ##\n"91 details = metrics[service]92 if not details["service_attributes"]["pro"]:93 output += "community\n"94 elif not details["service_attributes"]["community"]:95 output += "pro only\n"96 else:97 output += "community, and pro features\n"98 del metrics[service]["service_attributes"]99 operation_counter = len(details)100 operation_tested = 0101 tmp = ""102 for operation in sorted(details.keys()):103 op_details = details[operation]104 if op_details.get("invoked", 0) > 0:105 operation_tested += 1106 aws_validated = f"{AWS_VALIDATED if op_details.get('aws_validated') or op_details.get('snapshot') else ''}"107 snapshot = f"{SNAPSHOT if aws_validated and not op_details.get('snapshot_skipped_paths') else SNAPSHOT_SKIP_VERIFY if aws_validated else ''}"108 tmp += f"{template_implemented_item}{operation} {aws_validated} {snapshot}\n"109 else:110 tmp += f"{template_not_implemented_item}{operation}\n"111 if op_details.get("parameters"):112 parameters = op_details.get("parameters")113 if parameters:114 tmp += _generate_details_block("parameters hit", parameters)115 if op_details.get("errors"):116 tmp += _generate_details_block("errors hit", op_details["errors"])117 output += f"<details><summary>{operation_tested/operation_counter*100:.2f}% test coverage</summary>\n\n{tmp}\n</details>\n"118 with open(file_name, "a") as fd:119 fd.write(f"{output}\n")120 output = ""121def _init_service_metric_counter() -> Dict:122 metric_recorder = {}123 from localstack.aws.spec import load_service124 for s, provider in SERVICE_PLUGINS.api_provider_specs.items():125 try:126 service = load_service(s)127 ops = {}128 service_attributes = {"pro": "pro" in provider, "community": "default" in provider}129 ops["service_attributes"] = service_attributes130 for op in service.operation_names:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful