mirror of
https://github.com/hasso5703/alzeo.git
synced 2026-12-06 12:54:19 +01:00
CI: a cockpit test file that fails on its own fails the step
The per-file loop ran each dashboard test file directly with || true and compared the 'Ran N' count only, so a file that failed alone, and passed in the full run after the modules that set its environment, went through. Its exit status is checked now (a mutant test that only passes after the modules before it: green before, red now). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f532eac3d5
commit
893ff1f653
1 file changed
+5
-2
@@ -67,10 +67,13 @@ jobs:
|
||||
[ "$ran" = "$declared" ] || { echo "unittest ran $ran of $declared declared tests"; exit 1; }
|
||||
# Each file must also RUN its tests when invoked directly, the way a
|
||||
# human and the old CI step do. A file without a __main__ block exits 0
|
||||
# having run nothing, so only the reported count proves anything.
|
||||
# having run nothing, so the reported count is checked; and a file that
|
||||
# fails on its own, but passes after the modules that run before it in
|
||||
# the full run (an environment they leave set), fails here: its exit
|
||||
# status was dropped until 2026-09-24.
|
||||
for f in $(cd tests && ls test_*.py | sed 's/\.py$//' | sort); do
|
||||
d=$(grep -c 'def test_' "tests/$f.py")
|
||||
o=$(python3 "tests/$f.py" 2>&1 || true)
|
||||
o=$(python3 "tests/$f.py" 2>&1) || { echo "$f.py fails when run on its own:"; echo "$o" | tail -20; exit 1; }
|
||||
r=$(echo "$o" | grep -oE 'Ran [0-9]+' | grep -oE '[0-9]+' || echo 0)
|
||||
echo " $f.py run directly: ran $r of $d"
|
||||
[ "$r" = "$d" ] || { echo "$f.py ran $r of its $d tests when invoked directly"; exit 1; }
|
||||
|
||||
Reference in new issue
Block a user