Skip to content

Commit a38e950

Browse files
committed
Improved travis scripts: now a bug in tests collection will fail the build, while failing tests will not and will just be reported in the KPI.
1 parent a261fed commit a38e950

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@ script:
4242
- python ./code_generation/mini_lambda_methods_generation.py
4343
- pip install .
4444
- python -c "import os; os.chdir('..'); import mini_lambda"
45+
# ***tests***
46+
# - coverage run tests.py
47+
# - pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html --cov-report term-missing --cov=./mini_lambda -v mini_lambda/tests/
48+
# now done in a dedicated script to capture exit code 1 and transform it to 0
49+
- chmod a+x ./ci_tools/run_tests.sh
50+
- sh ./ci_tools/run_tests.sh
4551

4652
after_success:
47-
# ***tests***
48-
- pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html --cov-report term-missing --cov=./mini_lambda -v mini_lambda/tests/
4953
# ***reporting***
5054
# - junit2html junit.xml testrun.html output is really not nice
5155
- ant -f ci_tools/generate-junit-html.xml # generates the html for the test results. Actually we dont use it anymore

ci_tools/run_tests.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
cleanup() {
4+
rv=$?
5+
# on exit code 1 this is normal (some tests failed), do not stop the build
6+
if [ "$rv" = "1" ]; then
7+
exit 0
8+
else
9+
exit $rv
10+
fi
11+
}
12+
13+
trap "cleanup" INT TERM EXIT
14+
pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html --cov-report term-missing --cov=./mini_lambda -v mini_lambda/tests/

0 commit comments

Comments
 (0)