summaryrefslogtreecommitdiffstats
path: root/debian/tests/unit-tests-stable.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-26 04:06:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-26 04:06:30 +0000
commitc184d539b46002a85130c44d7c1fac4b3c7b870a (patch)
treec0ca3c082eb08adc185c2bf933cdf4b71ea049c0 /debian/tests/unit-tests-stable.py
parentMerging upstream version 9.5.1+dfsg. (diff)
downloadansible-c184d539b46002a85130c44d7c1fac4b3c7b870a.tar.xz
ansible-c184d539b46002a85130c44d7c1fac4b3c7b870a.zip
Merging debian version 9.5.1+dfsg-1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/unit-tests-stable.py')
-rwxr-xr-xdebian/tests/unit-tests-stable.py63
1 files changed, 63 insertions, 0 deletions
diff --git a/debian/tests/unit-tests-stable.py b/debian/tests/unit-tests-stable.py
new file mode 100755
index 000000000..f44044991
--- /dev/null
+++ b/debian/tests/unit-tests-stable.py
@@ -0,0 +1,63 @@
+#!/usr/bin/python3
+
+import glob
+import os
+import subprocess
+import sys
+
+sys.dont_write_bytecode = True
+from flaky_tests_list import flaky_test_dirs
+
+cwd = os.getcwd()
+
+overall_test_rc = 0
+failed_tests = []
+
+# find all dirs that have unit tests
+for i in glob.glob('ansible_collections/**/tests/unit', recursive=True):
+
+ # base path to run ansible-test is two levels up
+ testdir = os.path.normpath(
+ os.path.join(i, '..', '..')
+ )
+
+ # skip any tests that are flagged as flaky
+ if testdir in flaky_test_dirs:
+ print("Skipping", testdir)
+ continue
+
+ os.chdir(testdir)
+
+ print ("\n\n", flush=True)
+ print ("############################################################", flush=True)
+ print ("############################################################", flush=True)
+ print ("#### Running tests in", testdir, flush=True)
+ print ("############################################################", flush=True)
+ print ("############################################################", flush=True)
+
+ rc = subprocess.run([
+ '/usr/bin/ansible-test',
+ 'units',
+ '--python-interpreter',
+ '/usr/bin/python3',
+ '--local'
+ ])
+
+
+ if rc.returncode != 0:
+ failed_tests.append(i)
+ overall_test_rc = rc.returncode
+
+ os.chdir(cwd)
+
+
+if overall_test_rc != 0:
+ print ("############################################################", flush=True)
+ print ("############################################################", flush=True)
+ print ("#### failed tests are:", flush=True)
+ for i in failed_tests:
+ print ("####", i, flush=True)
+ print ("############################################################", flush=True)
+ print ("############################################################", flush=True)
+
+exit(overall_test_rc)