Skip to content
Snippets Groups Projects
Commit c0b3edd1 authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

:ambulance: detect import errors in run_tests

parent 082f9923
No related branches found
No related tags found
1 merge request!126🚑 detect import errors in run_tests
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
Make docker_pylint work on Odoo 11 projects that uses python3.8. Make docker_pylint work on Odoo 11 projects that uses python3.8.
Detect import errors in run_tests.
16.6.0 16.6.0
------ ------
......
...@@ -73,6 +73,12 @@ ...@@ -73,6 +73,12 @@
then then
tests_errors=0 tests_errors=0
fi fi
import_errors=$(grep -P 'o(penerp|doo).(modules.module|[^ ]+): Can not `import [a-z0-9_]+`.' $logfile)
import_errors_number=$(cat $import_errors|wc -l)
if [[ "$import_errors_number" -ne 0 ]];
then
test_errors=$((test_errors+import_errors_number))
fi
fi fi
# create a OpenMetrics metrics file # create a OpenMetrics metrics file
if [ "$CI" = "true" ]; if [ "$CI" = "true" ];
...@@ -85,6 +91,10 @@ ...@@ -85,6 +91,10 @@
fi fi
# odoo 13 uses FAIL as the error message, in the form: FAIL: TestReorderingRule.test_reordering_rule # odoo 13 uses FAIL as the error message, in the form: FAIL: TestReorderingRule.test_reordering_rule
failed=$(grep ' FAIL\(ED\|:\)\| CRITICAL\| ERROR [^ ]* openerp.modules.module: Can not .import openerp\.addons\.\| TEST .* ERROR:\|Failed to initialize database\| ERROR \([[:alnum:]]\|_\)* .\+\.test_.\+ ERROR: ' $logfile -c) failed=$(grep ' FAIL\(ED\|:\)\| CRITICAL\| ERROR [^ ]* openerp.modules.module: Can not .import openerp\.addons\.\| TEST .* ERROR:\|Failed to initialize database\| ERROR \([[:alnum:]]\|_\)* .\+\.test_.\+ ERROR: ' $logfile -c)
if [[ -n "$import_errors_number" ]];
then
failed=$((failed+$import_errors_number))
fi
warnings=$(grep ' WARNING ' $logfile -c) warnings=$(grep ' WARNING ' $logfile -c)
# XXX Not sure this is needed anymore with the tests_failures/tests_errors detection # XXX Not sure this is needed anymore with the tests_failures/tests_errors detection
if [[ $failed -eq 0 ]]; if [[ $failed -eq 0 ]];
...@@ -121,6 +131,10 @@ ...@@ -121,6 +131,10 @@
GREP_COLOR='0;31' grep --color=always "TEST .* ERROR:" $logfile GREP_COLOR='0;31' grep --color=always "TEST .* ERROR:" $logfile
# this one is for odoo 13 for tests that produces errors (failures are matched with FAIL: ) # this one is for odoo 13 for tests that produces errors (failures are matched with FAIL: )
GREP_COLOR='0;31' grep --color=always "ERROR \([[:alnum:]]\|_\)* .\+\.test_.\+ ERROR:" $logfile GREP_COLOR='0;31' grep --color=always "ERROR \([[:alnum:]]\|_\)* .\+\.test_.\+ ERROR:" $logfile
if [[ -n "$import_errors" ]];
then
echo $import_errors
fi
fi fi
echo '' echo ''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment