summaryrefslogtreecommitdiffstats
path: root/debian/tests/ansible-test-integration.py
diff options
context:
space:
mode:
Diffstat (limited to 'debian/tests/ansible-test-integration.py')
-rwxr-xr-xdebian/tests/ansible-test-integration.py33
1 files changed, 18 insertions, 15 deletions
diff --git a/debian/tests/ansible-test-integration.py b/debian/tests/ansible-test-integration.py
index c9b657f..2d68b34 100755
--- a/debian/tests/ansible-test-integration.py
+++ b/debian/tests/ansible-test-integration.py
@@ -1,7 +1,6 @@
#!/usr/bin/python3
import argparse
-import glob
import os
import subprocess
import sys
@@ -31,8 +30,8 @@ def runprog (name, progargs, exit_on_failure=True):
log(1, "#### STDERR ####")
log(1, proc.stderr)
log(0,"#"*72)
- if exit_on_failure == True:
- exit(proc.returncode)
+ if exit_on_failure:
+ sys.exit(proc.returncode)
return proc
def locale_debug(name):
@@ -43,7 +42,11 @@ def locale_debug(name):
prog = runprog('cat /etc/default/locale', ['cat', '/etc/default/locale'])
log(2, prog.stdout, prog.stderr)
# grep will exit 1 when it doesn't return anything, so don't fail on it.
- prog = runprog('grep -v -P \'^#|^$\' /etc/locale.gen', ['grep', '-v', '-P', '^#|^$', '/etc/locale.gen'], exit_on_failure=False)
+ prog = runprog(
+ 'grep -v -P \'^#|^$\' /etc/locale.gen',
+ ['grep', '-v', '-P', '^#|^$', '/etc/locale.gen'],
+ exit_on_failure=False,
+ )
log(2, prog.stdout, prog.stderr)
parser = argparse.ArgumentParser(
@@ -112,7 +115,8 @@ parser.add_argument(
'--verbose', '-v',
action='count',
default=1,
- help='verbosity between 0 and 5. 0 will only emit errors. 1=INFO. More for increasing levels of debug info. Defaults to 1.',
+ help='verbosity between 0 and 5. 0 will only emit errors. 1=INFO. \
+ More for increasing levels of debug info. Defaults to 1.',
)
args = parser.parse_args()
@@ -121,7 +125,7 @@ locale_debug('locale before setting os.environ:')
os.environ['LANG'] = 'en_US.UTF-8'
locale_debug('locale after setting os.environ:')
-if args.setup == True:
+if args.setup is True:
proc = runprog('testbed-setup.sh', ['sudo', './debian/tests/testbed-setup.sh'])
log(2,"#### STDOUT ####")
log(2, proc.stdout)
@@ -221,32 +225,32 @@ default_targets = list(
targets = []
skipped = []
-if args.default_tests == True:
+if args.default_tests is True:
targets.extend(default_targets)
else:
skipped.extend(default_targets)
-if args.requires_root == True:
+if args.requires_root is True:
targets.extend(integration_requires_root)
else:
skipped.extend(integration_requires_root)
-if args.requires_ssh == True:
+if args.requires_ssh is True:
targets.extend(integration_requires_ssh)
else:
skipped.extend(integration_requires_ssh)
-if args.requires_apt_mark_manual == True:
+if args.requires_apt_mark_manual is True:
targets.extend(integration_requires_apt_mark_manual)
else:
skipped.extend(integration_requires_apt_mark_manual)
-if args.fails_on_pip == True:
+if args.fails_on_pip is True:
targets.extend(integration_fails_on_pip)
else:
skipped.extend(integration_fails_on_pip)
-if args.failing == True:
+if args.failing is True:
targets.extend(integration_failing)
else:
skipped.extend(integration_failing)
@@ -256,7 +260,7 @@ skipped.sort()
for i in targets:
- if args.dry_run == True:
+ if args.dry_run is True:
log(1, 'Would run ansible-test in', i)
skipped.append(i)
continue
@@ -277,7 +281,6 @@ for i in targets:
i
])
-
if proc.returncode != 0:
failed_tests.append(i)
overall_test_rc = proc.returncode
@@ -306,4 +309,4 @@ log(2, '### skipped test list:')
for i in skipped:
log(2, i)
-exit(overall_test_rc)
+sys.exit(overall_test_rc)