diff options
author | Jonathan Lange <jml@canonical.com> | 2011-11-01 11:39:51 -0400 |
---|---|---|
committer | Jonathan Lange <jml@canonical.com> | 2011-11-01 11:39:51 -0400 |
commit | 25c82c64812e8e031fa3500c3fae5aa650e248cb (patch) | |
tree | d78396b525369b1dd05793056d09d207fd024e66 /testrepository/ui | |
parent | a7a909c61b8c45ada02f41a27e2f30f66e880892 (diff) | |
download | testrepository-git-25c82c64812e8e031fa3500c3fae5aa650e248cb.tar.gz |
Put output_summary in the UI interface.
Diffstat (limited to 'testrepository/ui')
-rw-r--r-- | testrepository/ui/__init__.py | 15 | ||||
-rw-r--r-- | testrepository/ui/cli.py | 4 | ||||
-rw-r--r-- | testrepository/ui/decorator.py | 3 | ||||
-rw-r--r-- | testrepository/ui/model.py | 3 |
4 files changed, 25 insertions, 0 deletions
diff --git a/testrepository/ui/__init__.py b/testrepository/ui/__init__.py index 7df5bf2..b608a61 100644 --- a/testrepository/ui/__init__.py +++ b/testrepository/ui/__init__.py @@ -140,6 +140,21 @@ class AbstractUI(object): """ raise NotImplementedError(self.output_values) + def output_summary(self, successful, values): + """Output a summary of a test run. + + An example summary might look like: + Run 565 (+2) tests in 2.968s + FAILED (errors=13 (-2), succeesses=31 (+2)) + + :param successful: A boolean indicating whether the result was + successful. + :param values: A dict mapping from name (e.g. "successes") to a tuple + of ``(value, delta)``. e.g. (31, -2) + + """ + raise NotImplementedError(self.output_summary) + def set_command(self, cmd): """Inform the UI what command it is running. diff --git a/testrepository/ui/cli.py b/testrepository/ui/cli.py index 9d3da20..1e49e38 100644 --- a/testrepository/ui/cli.py +++ b/testrepository/ui/cli.py @@ -134,6 +134,10 @@ class UI(ui.AbstractUI): outputs.append('%s=%s' % (label, value)) self._stdout.write('%s\n' % ', '.join(outputs)) + def output_summary(self, successful, values): + # XXX: Actually implement this properly. + pass + def _check_cmd(self): parser = OptionParser() parser.add_option("-d", "--here", dest="here", diff --git a/testrepository/ui/decorator.py b/testrepository/ui/decorator.py index 5cd3128..ba89606 100644 --- a/testrepository/ui/decorator.py +++ b/testrepository/ui/decorator.py @@ -83,6 +83,9 @@ class UI(ui.AbstractUI): def output_values(self, values): return self._decorated.output_values(values) + def output_summary(self, successful, values): + return self._decorated.output_summary(successful, values) + def set_command(self, cmd): self.cmd = cmd result = True diff --git a/testrepository/ui/model.py b/testrepository/ui/model.py index de2a0f1..e8ac43d 100644 --- a/testrepository/ui/model.py +++ b/testrepository/ui/model.py @@ -161,6 +161,9 @@ class UI(ui.AbstractUI): def output_values(self, values): self.outputs.append(('values', values)) + def output_summary(self, successful, values): + self.outputs.append(('summary', successful, values)) + def subprocess_Popen(self, *args, **kwargs): # Really not an output - outputs should be renamed to events. self.outputs.append(('popen', args, kwargs)) |