Skip to content

Commit c8f3261

Browse files
Update ci.yml
1 parent 44b79c6 commit c8f3261

File tree

1 file changed

+42
-7
lines changed

1 file changed

+42
-7
lines changed

.github/workflows/ci.yml

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,49 @@ jobs:
1818
python -m pip install --upgrade pip
1919
pip install pytest==8.3.3 z3-solver==4.13.0.0 gradio==4.44.0
2020
21-
- name: Compile for early syntax errors
21+
- name: Show repo state
22+
run: |
23+
python -V
24+
pip list
25+
echo "root files:"
26+
ls -la
27+
echo "tests dir:"
28+
ls -la tests || true
29+
echo "pytest.ini (may be absent):"
30+
cat pytest.ini || true
31+
32+
- name: Import sanity outside pytest
2233
run: |
23-
python -m py_compile gradio_demo.py
2434
python - <<'PY'
25-
import glob, py_compile
26-
[py_compile.compile(p, doraise=True) for p in glob.glob("tests/*.py")]
27-
print("compiled tests ok")
35+
import importlib, sys
36+
print("import gradio_demo:", importlib.util.find_spec("gradio_demo") is not None)
37+
import gradio_demo as gd
38+
print("audit first line:", gd.audit("penguin on ice").splitlines()[0])
39+
from z3 import Solver, Bool, sat
40+
s = Solver(); x = Bool("x"); s.add(x == True)
41+
print("z3 sat check:", s.check() == sat)
2842
PY
2943
30-
- name: Run tests
31-
run: pytest -ra
44+
- name: Collect tests verbosely
45+
run: |
46+
set -x
47+
pytest --collect-only -vv tests || true
48+
echo "collect exit code: $?"
49+
50+
- name: Run tests one by one to expose the first failing import
51+
run: |
52+
set -x
53+
for f in tests/*.py; do
54+
echo "==== running $f ===="
55+
pytest -vv "$f" || true
56+
echo "exit code for $f: $?"
57+
done
58+
# force a failure at the end if any test failed
59+
python - <<'PY'
60+
import sys, pathlib, subprocess
61+
failed = False
62+
for p in pathlib.Path("tests").glob("*.py"):
63+
r = subprocess.run(["pytest","-q",str(p)])
64+
failed = failed or r.returncode != 0
65+
sys.exit(1 if failed else 0)
66+
PY

0 commit comments

Comments
 (0)