This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 96212cb Fix MyPy errors in `scripts/in_container` (#20280)
96212cb is described below
commit 96212cb8f5e7e1e8caba18d92f58755a33b07a67
Author: Josh Fell <[email protected]>
AuthorDate: Tue Dec 14 06:31:47 2021 -0500
Fix MyPy errors in `scripts/in_container` (#20280)
---
scripts/in_container/check_junitxml_result.py | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/scripts/in_container/check_junitxml_result.py
b/scripts/in_container/check_junitxml_result.py
index cc69d94..7381904 100755
--- a/scripts/in_container/check_junitxml_result.py
+++ b/scripts/in_container/check_junitxml_result.py
@@ -29,15 +29,22 @@ if __name__ == '__main__':
with open(fname) as fh:
root = ET.parse(fh)
testsuite = root.find('.//testsuite')
- num_failures = int(testsuite.get('failures'))
- num_errors = int(testsuite.get('errors'))
- if num_failures == 0 and num_errors == 0:
- print(f'\n{TEXT_GREEN}==== No errors, no failures. Good to go!
===={TEXT_RESET}\n')
- sys.exit(0)
+ if testsuite:
+ num_failures = testsuite.get('failures')
+ num_errors = testsuite.get('errors')
+ if num_failures == "0" and num_errors == "0":
+ print(f'\n{TEXT_GREEN}==== No errors, no failures. Good to go!
===={TEXT_RESET}\n')
+ sys.exit(0)
+ else:
+ print(
+ f'\n{TEXT_RED}==== Errors: {num_errors}, Failures:
{num_failures}. '
+ f'Failing the test! ===={TEXT_RESET}\n'
+ )
+ sys.exit(1)
else:
print(
- f'\n{TEXT_RED}==== Errors: {num_errors}, Failures:
{num_failures}. '
- f'Failing the test! ===={TEXT_RESET}\n'
+ f'\n{TEXT_RED}==== The testsuite element does not exist in
file {fname!r}. '
+ f'Cannot evaluate status of the test! ===={TEXT_RESET}\n'
)
sys.exit(1)
except Exception as e: