summaryrefslogtreecommitdiff
path: root/.ci/fail_skipped_tests.py
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2021-09-07 16:22:21 +0200
committerBastien Nocera <hadess@hadess.net>2021-09-07 16:22:21 +0200
commitffd452c1b76efa65682b159f96bad802fef95143 (patch)
treeda6f1469d39a42c4bb310b103602c57e3e7cef07 /.ci/fail_skipped_tests.py
parentdff7a794e55d6ad7a10e8edacd73aa047593e74c (diff)
downloadlibgudev-ffd452c1b76efa65682b159f96bad802fef95143.tar.gz
ci: Fail CI if a test is skipped
Diffstat (limited to '.ci/fail_skipped_tests.py')
-rwxr-xr-x.ci/fail_skipped_tests.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/.ci/fail_skipped_tests.py b/.ci/fail_skipped_tests.py
new file mode 100755
index 0000000..6349921
--- /dev/null
+++ b/.ci/fail_skipped_tests.py
@@ -0,0 +1,25 @@
+#!/usr/bin/python3
+
+from lxml import etree
+import sys
+
+def format_title(title):
+ """Put title in a box"""
+ box = {
+ 'tl': '╔', 'tr': '╗', 'bl': '╚', 'br': '╝', 'h': '═', 'v': '║',
+ }
+ hline = box['h'] * (len(title) + 2)
+
+ return '\n'.join([
+ f"{box['tl']}{hline}{box['tr']}",
+ f"{box['v']} {title} {box['v']}",
+ f"{box['bl']}{hline}{box['br']}",
+ ])
+
+tree = etree.parse(sys.argv[1])
+for suite in tree.xpath('/testsuites/testsuite'):
+ skipped = suite.get('skipped')
+ if int(skipped) != 0:
+ print(format_title('Tests were skipped when they should not have been. All the tests must be run in the CI'),
+ end='\n\n', flush=True)
+ sys.exit(1)