- text = ""
- for idx, test_set in enumerate(alert.get("include", [])):
- build, version, nr, failed_tests = \
+ try:
+ with open(in_file, u'r') as txt_file:
+ file_content = txt_file.read()
+ with open(out_file, u'a+') as reg_file:
+ reg_file.write(header)
+ if file_content:
+ reg_file.write(file_content)
+ else:
+ reg_file.write(f"No {re_pro}")
+ except IOError as err:
+ logging.warning(repr(err))
+
+ def _generate_email_body(self, alert):
+ """Create the file which is used in the generated alert.
+
+ :param alert: Files are created for this alert.
+ :type alert: dict
+ """
+
+ if alert[u"type"] != u"failed-tests":
+ raise AlertingError(
+ f"Alert of type {alert[u'type']} is not implemented."
+ )
+
+ text = u""
+ for idx, test_set in enumerate(alert.get(u"include", list())):
+ test_set_short = u""
+ device = u""
+ try:
+ groups = re.search(
+ re.compile(
+ r'((vpp|dpdk)-\dn-(skx|clx|hsw|tsh|dnv|zn2)-.*)'
+ ),
+ test_set
+ )
+ test_set_short = groups.group(1)
+ device = groups.group(2)
+ except (AttributeError, IndexError):
+ logging.error(
+ f"The test set {test_set} does not include information "
+ f"about test bed. Using empty string instead."
+ )
+ build, version, passed, failed, failed_tests = \