(slack_channel_name=None)
| 15 | |
| 16 | |
| 17 | def main(slack_channel_name=None): |
| 18 | failed = [] |
| 19 | passed = [] |
| 20 | |
| 21 | group_info = [] |
| 22 | |
| 23 | total_num_failed = 0 |
| 24 | empty_file = False or len(list(Path().glob("*.log"))) == 0 |
| 25 | |
| 26 | total_empty_files = [] |
| 27 | |
| 28 | for log in Path().glob("*.log"): |
| 29 | section_num_failed = 0 |
| 30 | i = 0 |
| 31 | with open(log) as f: |
| 32 | for line in f: |
| 33 | line = json.loads(line) |
| 34 | i += 1 |
| 35 | if line.get("nodeid", "") != "": |
| 36 | test = line["nodeid"] |
| 37 | if line.get("duration", None) is not None: |
| 38 | duration = f"{line['duration']:.4f}" |
| 39 | if line.get("outcome", "") == "failed": |
| 40 | section_num_failed += 1 |
| 41 | failed.append([test, duration, log.name.split("_")[0]]) |
| 42 | total_num_failed += 1 |
| 43 | else: |
| 44 | passed.append([test, duration, log.name.split("_")[0]]) |
| 45 | empty_file = i == 0 |
| 46 | group_info.append([str(log), section_num_failed, failed]) |
| 47 | total_empty_files.append(empty_file) |
| 48 | os.remove(log) |
| 49 | failed = [] |
| 50 | text = ( |
| 51 | "🌞 There were no failures!" |
| 52 | if not any(total_empty_files) |
| 53 | else "Something went wrong there is at least one empty file - please check GH action results." |
| 54 | ) |
| 55 | no_error_payload = { |
| 56 | "type": "section", |
| 57 | "text": { |
| 58 | "type": "plain_text", |
| 59 | "text": text, |
| 60 | "emoji": True, |
| 61 | }, |
| 62 | } |
| 63 | |
| 64 | message = "" |
| 65 | payload = [ |
| 66 | { |
| 67 | "type": "header", |
| 68 | "text": { |
| 69 | "type": "plain_text", |
| 70 | "text": "🤗 Results of the Diffusers scheduled nightly tests.", |
| 71 | }, |
| 72 | }, |
| 73 | ] |
| 74 | if total_num_failed > 0: |
no test coverage detected
searching dependent graphs…