diff --git a/NEWS.rst b/NEWS.rst index 082f99239820852fa960afc963ae35eede65c8fb_TkVXUy5yc3Q=..c0b3edd1cb7b142d36a5defa4826dbfdb14fda81_TkVXUy5yc3Q= 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -11,6 +11,8 @@ Make docker_pylint work on Odoo 11 projects that uses python3.8. +Detect import errors in run_tests. + 16.6.0 ------ diff --git a/run_tests b/run_tests index 082f99239820852fa960afc963ae35eede65c8fb_cnVuX3Rlc3Rz..c0b3edd1cb7b142d36a5defa4826dbfdb14fda81_cnVuX3Rlc3Rz 100755 --- a/run_tests +++ b/run_tests @@ -73,6 +73,12 @@ then tests_errors=0 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 # create a OpenMetrics metrics file if [ "$CI" = "true" ]; @@ -85,6 +91,10 @@ fi # 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) +if [[ -n "$import_errors_number" ]]; +then + failed=$((failed+$import_errors_number)) +fi warnings=$(grep ' WARNING ' $logfile -c) # XXX Not sure this is needed anymore with the tests_failures/tests_errors detection if [[ $failed -eq 0 ]]; @@ -121,6 +131,10 @@ 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: ) GREP_COLOR='0;31' grep --color=always "ERROR \([[:alnum:]]\|_\)* .\+\.test_.\+ ERROR:" $logfile + if [[ -n "$import_errors" ]]; + then + echo $import_errors + fi fi echo ''