Check the pytest output status instead of grepping the log file for tests status
This commit is contained in:
parent
d6c236a5b1
commit
f57a3b2a0b
1 changed files with 8 additions and 19 deletions
|
@ -28,23 +28,8 @@ install_repo() {
|
||||||
run_tests() {
|
run_tests() {
|
||||||
echo "Running tests"
|
echo "Running tests"
|
||||||
cd "$REPO_DIR"
|
cd "$REPO_DIR"
|
||||||
./run_tests.sh 2>&1 | tee "$TEST_LOG"
|
pytest 2>&1 | tee "$TEST_LOG"
|
||||||
}
|
return $?
|
||||||
|
|
||||||
check_test_results() {
|
|
||||||
failed_tests=$(grep -e '^FAILED' "$TEST_LOG")
|
|
||||||
ret=0
|
|
||||||
|
|
||||||
if [[ ! -z "$failed_tests" ]]; then
|
|
||||||
echo "------------------"
|
|
||||||
echo "Some tests failed!"
|
|
||||||
echo "------------------"
|
|
||||||
ret=2
|
|
||||||
else
|
|
||||||
echo "All tests passed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return $ret
|
|
||||||
}
|
}
|
||||||
|
|
||||||
########
|
########
|
||||||
|
@ -55,10 +40,14 @@ cleanup
|
||||||
prepare_venv
|
prepare_venv
|
||||||
install_repo
|
install_repo
|
||||||
run_tests
|
run_tests
|
||||||
|
|
||||||
check_test_results
|
|
||||||
ret=$?
|
ret=$?
|
||||||
|
|
||||||
|
if [[ $ret == 0 ]]; then
|
||||||
|
echo "Status: PASSED"
|
||||||
|
else
|
||||||
|
echo "Status: FAILED"
|
||||||
|
fi
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
exit $ret
|
exit $ret
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue