aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2011-07-28 19:13:11 +0200
committerMichał Górny <mgorny@gentoo.org>2011-07-28 19:13:11 +0200
commit079c4be9ec9753ae426a3935af6b4a53f3c49556 (patch)
tree596214e17818166319db7f83b0bc645c2ceb8230 /pmstestsuite/cli.py
parentAdd a test for DEFINED_PHASES due to eclass inherit. (diff)
downloadpms-test-suite-079c4be9ec9753ae426a3935af6b4a53f3c49556.tar.gz
pms-test-suite-079c4be9ec9753ae426a3935af6b4a53f3c49556.tar.bz2
pms-test-suite-079c4be9ec9753ae426a3935af6b4a53f3c49556.zip
Introduce asserts for test cases.
Diffstat (limited to 'pmstestsuite/cli.py')
-rw-r--r--pmstestsuite/cli.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/pmstestsuite/cli.py b/pmstestsuite/cli.py
index 518d826..892b8ab 100644
--- a/pmstestsuite/cli.py
+++ b/pmstestsuite/cli.py
@@ -111,7 +111,7 @@ class PMSTestSuiteCLI(object):
self.pm.package_limit = opts.limit_pkgs
self.update_manifests = not opts.no_manifests
-
+
limit_tests = set()
for t in opts.tests:
limit_tests.update(t.split())
@@ -121,8 +121,17 @@ class PMSTestSuiteCLI(object):
def tests_done(self):
print('-> Checking test results...')
self.failed = []
+ self.asserts = [] # temporary
for t in self.test_library:
- res = t.check_result(self.pm)
+ try:
+ res = t.check_result(self.pm)
+ except AssertionError as e:
+ res = False
+ self.asserts.append(str(e))
+ else:
+ # forward compat
+ if res is None:
+ res = True
if not res:
self.failed.append(t)
t.clean(self.pm)
@@ -143,6 +152,11 @@ class PMSTestSuiteCLI(object):
for t in self.failed:
print('- %s' % t)
+ if self.asserts:
+ print('[DEBUG] asserts:')
+ for a in self.asserts:
+ print('- %s' % a)
+
self.ret = 0 if not self.failed else 1
self.loop.quit()