Merge lp:~jml/testrepository/better-output-611706 into lp:~testrepository/testrepository/trunk

Proposed by Jonathan Lange
Status: Merged
Merged at revision: 93
Proposed branch: lp:~jml/testrepository/better-output-611706
Merge into: lp:~testrepository/testrepository/trunk
Diff against target: 38 lines (+3/-5)
2 files modified
testrepository/tests/ui/test_cli.py (+1/-1)
testrepository/ui/cli.py (+2/-4)
To merge this branch: bzr merge lp:~jml/testrepository/better-output-611706
Reviewer Review Type Date Requested Status
testrepository committers Pending
Review via email: mp+31673@code.launchpad.net

Commit message

Better display of multiple values on a single line, fixes bug 611706.

Description of the change

This branch changes output_values to display in "id=12, tests=123, skips=2" form rather than the current form which makes it slightly harder to match names to values (see the linked bug).

I chose the foo=bar form because it's what trial does and people seem to like it. I could be persuaded to move to "id: 12; tests: 123; skips: 2", I guess.

FWIW, I tried for about ten minutes to figure out how I could get "PASSED" or "FAILED" in front of the test summary, and then gave up.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'testrepository/tests/ui/test_cli.py'
2--- testrepository/tests/ui/test_cli.py 2010-02-28 07:33:06 +0000
3+++ testrepository/tests/ui/test_cli.py 2010-08-03 19:07:43 +0000
4@@ -119,7 +119,7 @@
5 def test_outputs_values_to_stdout(self):
6 ui, cmd = self.get_test_ui_and_cmd()
7 ui.output_values([('foo', 1), ('bar', 'quux')])
8- self.assertEqual('foo: 1 bar: quux\n', ui._stdout.getvalue())
9+ self.assertEqual('foo=1, bar=quux\n', ui._stdout.getvalue())
10
11 def test_parse_error_goes_to_stderr(self):
12 stdout = StringIO()
13
14=== modified file 'testrepository/ui/cli.py'
15--- testrepository/ui/cli.py 2010-02-07 20:16:28 +0000
16+++ testrepository/ui/cli.py 2010-08-03 19:07:43 +0000
17@@ -127,11 +127,10 @@
18 def output_values(self, values):
19 outputs = []
20 for label, value in values:
21- outputs.append('%s: %s' % (label, value))
22- self._stdout.write('%s\n' % ' '.join(outputs))
23+ outputs.append('%s=%s' % (label, value))
24+ self._stdout.write('%s\n' % ', '.join(outputs))
25
26 def _check_cmd(self):
27- cmd = self.cmd
28 parser = OptionParser()
29 parser.add_option("-d", "--here", dest="here",
30 help="Set the directory or url that a command should run from. "
31@@ -145,7 +144,6 @@
32 options, args = parser.parse_args(self._argv)
33 self.here = options.here
34 self.options = options
35- orig_args = list(args)
36 parsed_args = {}
37 failed = False
38 for arg in self.cmd.args:

Subscribers

People subscribed via source and target branches