* [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/, pmstestsuite/output/
@ 2011-08-05 17:09 Michał Górny
0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2011-08-05 17:09 UTC (permalink / raw
To: gentoo-commits
commit: b005815aa751b9954249966ec1e1fed5dd16d40f
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 5 17:10:34 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Aug 5 17:10:34 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=b005815a
Pass all test results to the output module.
---
pmstestsuite/cli.py | 4 +---
pmstestsuite/output/__init__.py | 2 +-
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/, pmstestsuite/output/
@ 2011-08-05 19:54 Michał Górny
0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2011-08-05 19:54 UTC (permalink / raw
To: gentoo-commits
commit: 6f33789cf7ad41482232df90470f9bfd4419d07b
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 5 17:15:05 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Aug 5 17:15:05 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=6f33789c
Support --output-file arg.
---
pmstestsuite/cli.py | 4 +++-
pmstestsuite/output/__init__.py | 3 +++
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/pmstestsuite/cli.py b/pmstestsuite/cli.py
index f315b47..b046578 100644
--- a/pmstestsuite/cli.py
+++ b/pmstestsuite/cli.py
@@ -60,6 +60,8 @@ class PMSTestSuiteCLI(object):
opt.add_option('-o', '--output-module', dest='outputmod',
help='Output module to use',
default='cli')
+ opt.add_option('-O', '--output-file', dest='outputfile',
+ help='File to write output to (may not be used)')
opt.add_option('-p', '--package-manager', dest='pm',
help='Package manager to use (can be specified multiple times)',
action='append', default=[])
@@ -107,7 +109,7 @@ class PMSTestSuiteCLI(object):
for x in get_output_modules():
if x.name == opts.outputmod:
- self.output = x()
+ self.output = x(opts.outputfile)
break
else:
opt.error('Output module not available: %s' % opts.outputmod)
diff --git a/pmstestsuite/output/__init__.py b/pmstestsuite/output/__init__.py
index 5cdb23e..cef7ab8 100644
--- a/pmstestsuite/output/__init__.py
+++ b/pmstestsuite/output/__init__.py
@@ -57,6 +57,9 @@ class OutputModule(ABCObject):
"""
pass
+ def __init__(self, output_file = None):
+ pass
+
@abstractmethod
def __call__(self, results, verbose = False):
"""
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/, pmstestsuite/output/
@ 2012-01-03 17:50 Michał Górny
0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2012-01-03 17:50 UTC (permalink / raw
To: gentoo-commits
commit: 395b59ef8051775eeaa3518cf2928ffd9d2cf92e
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 3 16:43:27 2012 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jan 3 16:43:27 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=395b59ef
Reraise test case exceptions neatly.
---
pmstestsuite/cli.py | 4 +++-
pmstestsuite/output/__init__.py | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/pmstestsuite/cli.py b/pmstestsuite/cli.py
index ac8dd2e..a0abf02 100644
--- a/pmstestsuite/cli.py
+++ b/pmstestsuite/cli.py
@@ -198,7 +198,9 @@ class PMSTestSuiteCLI(object):
outc = '.'
elif tr.exception:
outc = 'E'
- raise tr.exception
+ self.exception = tr.exception
+ self.loop.quit()
+ return
else:
outc = 'F'
print(outc, end='')
diff --git a/pmstestsuite/output/__init__.py b/pmstestsuite/output/__init__.py
index 341fcd8..fcfd27e 100644
--- a/pmstestsuite/output/__init__.py
+++ b/pmstestsuite/output/__init__.py
@@ -2,6 +2,8 @@
# (c) 2011 Michał Górny <mgorny@gentoo.org>
# Released under the terms of the 2-clause BSD license.
+from traceback import format_exc
+
from gentoopm.util import ABCObject, BoolCompat
from abc import abstractmethod, abstractproperty
@@ -27,7 +29,7 @@ class TestResult(BoolCompat):
self._res = self._FAILURE
except Exception as e:
self._res = self._EXCEPT
- self._exc = e
+ self._exc = format_exc()
else:
self._res = self._SUCCESS
self._assert = t.pop_assertions()
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-01-03 17:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-05 19:54 [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/, pmstestsuite/output/ Michał Górny
-- strict thread matches above, loose matches on Subject: below --
2012-01-03 17:50 Michał Górny
2011-08-05 17:09 Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox