upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tools/progress_dashboard.py
diff options
context:
space:
mode:
authorSilent <103598001+SebSilent@users.noreply.github.com>2026-11-22 22:58:17 -0300
committerSilent <103598001+SebSilent@users.noreply.github.com>2026-11-22 22:58:17 -0300
commit9fc6b263e459526f6646855a0444d95ecf9bbe21 (patch)
tree6461da3bc68b407ba5697015c1daa9f1b703e992 /tools/progress_dashboard.py
parent03b09a086592a197db64d91655c6e65c30764d96 (diff)
progress_dashboard: fail on an unlistable sub-folder instead of a partial test selection or code digest
Diffstat (limited to 'tools/progress_dashboard.py')
-rw-r--r--tools/progress_dashboard.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/progress_dashboard.py b/tools/progress_dashboard.py
index ddfddbf3a..5ea50a243 100644
--- a/tools/progress_dashboard.py
+++ b/tools/progress_dashboard.py
@@ -213,11 +213,17 @@ def last_commit_time(path):
213 213
214 214
215# ----------------------------------------------------------------------------------------------- unit tests 215# ----------------------------------------------------------------------------------------------- unit tests
216def _walk_error(exc: OSError):
217 # os.walk skips a directory it cannot list unless onerror raises; the dashboard must not report an
218 # incomplete test selection or code digest as complete. main() turns the OSError into one error line.
219 raise exc
220
221
216def ci_test_files(): 222def ci_test_files():
217 """tests/test_*.py that CI runs one by one: standard-library files with a __main__ block (ci.yml).""" 223 """tests/test_*.py that CI runs one by one: standard-library files with a __main__ block (ci.yml)."""
218 found = [] 224 found = []
219 tests = os.path.join(ROOT, "tests") 225 tests = os.path.join(ROOT, "tests")
220 for base, dirs, files in os.walk(tests): 226 for base, dirs, files in os.walk(tests, onerror=_walk_error):
221 dirs[:] = sorted(d for d in dirs if d not in ("semantic", "__pycache__", "fixtures")) 227 dirs[:] = sorted(d for d in dirs if d not in ("semantic", "__pycache__", "fixtures"))
222 for name in sorted(files): 228 for name in sorted(files):
223 if not (name.startswith("test_") and name.endswith(".py")): 229 if not (name.startswith("test_") and name.endswith(".py")):
@@ -262,7 +268,7 @@ def code_digest():
262 h = hashlib.sha256() 268 h = hashlib.sha256()
263 rels = ["make_game.py"] 269 rels = ["make_game.py"]
264 for d in CODE_DIRS: 270 for d in CODE_DIRS:
265 for base, dirs, files in os.walk(os.path.join(ROOT, d)): 271 for base, dirs, files in os.walk(os.path.join(ROOT, d), onerror=_walk_error):
266 dirs[:] = sorted(x for x in dirs if x not in ("__pycache__", "bin", "obj", "target", "build") and not x.startswith(".")) 272 dirs[:] = sorted(x for x in dirs if x not in ("__pycache__", "bin", "obj", "target", "build") and not x.startswith("."))
267 rels += [os.path.relpath(os.path.join(base, f), ROOT).replace("\\", "/") for f in sorted(files) if f.endswith(".py")] 273 rels += [os.path.relpath(os.path.join(base, f), ROOT).replace("\\", "/") for f in sorted(files) if f.endswith(".py")]
268 for rel in rels: 274 for rel in rels:
@@ -937,7 +943,11 @@ def main(argv=None):
937 print(f"--work {args.work} is not a folder", file=sys.stderr) 943 print(f"--work {args.work} is not a folder", file=sys.stderr)
938 return 2 944 return 2
939 os.makedirs(out_dir, exist_ok=True) 945 os.makedirs(out_dir, exist_ok=True)
940 snap = build(args, out_dir) 946 try:
947 snap = build(args, out_dir)
948 except OSError as exc:
949 print(f"error: {exc.filename or ''}: {exc.strerror or exc}", file=sys.stderr)
950 return 2
941 new = write_outputs(snap, out_dir) 951 new = write_outputs(snap, out_dir)
942 n = len(snap["components"]) 952 n = len(snap["components"])
943 print(f"{n} units, {len(snap['metrics'])} metrics -> {os.path.join(out_dir, 'progress.html')}" 953 print(f"{n} units, {len(snap['metrics'])} metrics -> {os.path.join(out_dir, 'progress.html')}"