浏览代码

#469 trying to fix tests

Rodja Trappe 2 年之前
父节点
当前提交
3419a57c2c
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      test_startup.sh

+ 5 - 4
test_startup.sh

@@ -1,7 +1,8 @@
 #!/usr/bin/env bash
 
 run() {
-    output=`{ timeout 10 python3 $1; } 2>&1`
+    [[ ${1##*.} == "py" ]] && cmd_prefix="python3" || cmd_prefix=""
+    output=$({ timeout 10 $cmd_prefix $1; } 2>&1)
     exitcode=$?
     test $exitcode -eq 124 && exitcode=0 # exitcode 124 is comming from "timeout command above"
     echo $output | grep -e "NiceGUI ready to go" -e "Uvicorn running on http://0.0.0.0:8000" > /dev/null || exitcode=1
@@ -27,12 +28,12 @@ check() {
     fi
 }
 
-error=0
 check main.py || error=1
 for path in examples/*
 do
-    if test -f $path/main.py
-    then
+    if test -f $path/start.sh; then
+       check $path/start.sh || error=1 
+    elif test -f $path/main.py; then
         check $path/main.py || error=1
     fi
 done