Check the pytest output status instead of grepping the log file for tests status

This commit is contained in:
Fabio Manganiello 2021-03-06 16:15:45 +01:00
parent d6c236a5b1
commit f57a3b2a0b

View file

@ -28,23 +28,8 @@ install_repo() {
run_tests() {
echo "Running tests"
cd "$REPO_DIR"
./run_tests.sh 2>&1 | tee "$TEST_LOG"
}
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
pytest 2>&1 | tee "$TEST_LOG"
return $?
}
########
@ -55,10 +40,14 @@ cleanup
prepare_venv
install_repo
run_tests
check_test_results
ret=$?
if [[ $ret == 0 ]]; then
echo "Status: PASSED"
else
echo "Status: FAILED"
fi
cleanup
exit $ret