diff options
author | 2011-08-05 19:10:34 +0200 | |
---|---|---|
committer | 2011-08-05 19:10:34 +0200 | |
commit | b005815aa751b9954249966ec1e1fed5dd16d40f (patch) | |
tree | a68afb7555e73094ba279de4225863f00f6ddba6 | |
parent | Support getting test results using multiple PMs. (diff) | |
download | pms-test-suite-b005815aa751b9954249966ec1e1fed5dd16d40f.tar.gz pms-test-suite-b005815aa751b9954249966ec1e1fed5dd16d40f.tar.bz2 pms-test-suite-b005815aa751b9954249966ec1e1fed5dd16d40f.zip |
Pass all test results to the output module.
-rw-r--r-- | pmstestsuite/cli.py | 4 | ||||
-rw-r--r-- | pmstestsuite/output/__init__.py | 2 | ||||
-rw-r--r-- | pmstestsuite/output/cli.py | 34 |
3 files changed, 21 insertions, 19 deletions
diff --git a/pmstestsuite/cli.py b/pmstestsuite/cli.py index 7f7bb48..f315b47 100644 --- a/pmstestsuite/cli.py +++ b/pmstestsuite/cli.py @@ -190,9 +190,7 @@ class PMSTestSuiteCLI(object): self.prepare() def all_done(self): - ret = True - for pm, res in self.results.items(): - ret &= self.output(res, verbose = self.verbose) + ret = self.output(self.results, verbose = self.verbose) self.ret = 0 if ret else 1 self.loop.quit() diff --git a/pmstestsuite/output/__init__.py b/pmstestsuite/output/__init__.py index e57aad9..5cdb23e 100644 --- a/pmstestsuite/output/__init__.py +++ b/pmstestsuite/output/__init__.py @@ -63,7 +63,7 @@ class OutputModule(ABCObject): Output the test results. @param results: test result dict - @type results: dict(L{TestCase} -> L{TestResult}) + @type results: dict(L{PackageManager} -> dict(L{TestCase} -> L{TestResult})) @param verbose: whether to output the results verbosely @type verbose: bool @return: whether all of the tests succeeded diff --git a/pmstestsuite/output/cli.py b/pmstestsuite/output/cli.py index 3d0217f..9c664ab 100644 --- a/pmstestsuite/output/cli.py +++ b/pmstestsuite/output/cli.py @@ -7,19 +7,23 @@ from pmstestsuite.output import OutputModule class CLIOutput(OutputModule): name = 'cli' - def __call__(self, results, verbose = False): - failed = filter(lambda tr: not tr[1], results.items()) - if not failed and not verbose: - print('%d tests completed successfully.' % len(results)) - else: - print('%d of %d tests completed successfully, %d failed:' - % (len(results) - len(failed), - len(results), len(failed))) - tl = failed if not verbose else results.items() - for t, r in tl: - print('- %s [%s]' % (t, 'OK' if r else 'FAILED')) - for a in r.assertions: - print('-> %s: %s [%s]' % (a.name, str(a), - 'OK' if a else 'FAILED')) + def __call__(self, allresults, verbose = False): + ret = True + for pm, results in allresults.items(): + failed = filter(lambda tr: not tr[1], results.items()) + if not failed and not verbose: + print('[%s] %d tests completed successfully.' + % (pm.name, len(results))) + else: + print('[%s] %d of %d tests completed successfully, %d failed:' + % (pm.name, len(results) - len(failed), + len(results), len(failed))) + tl = failed if not verbose else results.items() + for t, r in tl: + print('- %s [%s]' % (t, 'OK' if r else 'FAILED')) + for a in r.assertions: + print('-> %s: %s [%s]' % (a.name, str(a), + 'OK' if a else 'FAILED')) + ret &= bool(failed) - return bool(failed) + return ret |