File: check_log.py

package info (click to toggle)
pyzo 4.15.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 52,976 kB
  • sloc: python: 24,386; makefile: 163; xml: 36; sh: 2
file content (29 lines) | stat: -rw-r--r-- 763 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""
Small script to check the log generated by a test run (either frozen or source).
"""

import os
import sys

# Locate the log
logfilename = os.path.abspath(os.path.join(__file__, "..", "..", "log.txt"))
if not os.path.isfile(logfilename):
    raise RuntimeError(f"Pyzo log file not found in {logfilename}")

# Read and clear the log
with open(logfilename, "rt") as f:
    log = f.read()
os.remove(logfilename)

# Print the log
print("=" * 80)
print(log)

# Examine the results
if any(x in log.lower() for x in ["exception", "uncaught", "error"]):
    sys.exit("Errors detected during Pyzo test run :(")
elif not log.strip().endswith("Stopped"):
    sys.exit("Unclean stop for Pyzo test run :(")
else:
    print("==> Pyzo test run looks OK :)")
    sys.exit(0)