Merge lp://staging/~mbp/bzr/trivial-old into lp://staging/~bzr/bzr/trunk-old

Proposed by Martin Pool
Status: Merged
Approved by: Ian Clatworthy
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp://staging/~mbp/bzr/trivial-old
Merge into: lp://staging/~bzr/bzr/trunk-old
Diff against target: 94 lines
To merge this branch: bzr merge lp://staging/~mbp/bzr/trivial-old
Reviewer Review Type Date Requested Status
Ian Clatworthy Approve
Review via email: mp+9014@code.staging.launchpad.net

This proposal supersedes a proposal from 2009-07-19.

To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote : Posted in a previous version of this proposal

Two small fixes for selftest:

Don't show the log in the test failure if there isn't one.

Tweak the --verbose output so you're more likely to see the whole test name.

Revision history for this message
Ian Clatworthy (ian-clatworthy) wrote :

Looks fine. Minor grammar tweak: s/plus and/plus an/

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/tests/__init__.py'
2--- bzrlib/tests/__init__.py 2009-07-10 10:46:00 +0000
3+++ bzrlib/tests/__init__.py 2009-07-20 04:35:45 +0000
4@@ -195,11 +195,9 @@
5 def _testTimeString(self, testCase):
6 benchmark_time = self._extractBenchmarkTime(testCase)
7 if benchmark_time is not None:
8- return "%s/%s" % (
9- self._formatTime(benchmark_time),
10- self._elapsedTestTimeString())
11+ return self._formatTime(benchmark_time) + "*"
12 else:
13- return " %s" % self._elapsedTestTimeString()
14+ return self._elapsedTestTimeString()
15
16 def _formatTime(self, seconds):
17 """Format seconds as milliseconds with leading spaces."""
18@@ -346,15 +344,17 @@
19 self.stream.write("%s: " % flavour)
20 self.stream.writeln(self.getDescription(test))
21 if getattr(test, '_get_log', None) is not None:
22- self.stream.write('\n')
23- self.stream.write(
24- ('vvvv[log from %s]' % test.id()).ljust(78,'-'))
25- self.stream.write('\n')
26- self.stream.write(test._get_log())
27- self.stream.write('\n')
28- self.stream.write(
29- ('^^^^[log from %s]' % test.id()).ljust(78,'-'))
30- self.stream.write('\n')
31+ log_contents = test._get_log()
32+ if log_contents:
33+ self.stream.write('\n')
34+ self.stream.write(
35+ ('vvvv[log from %s]' % test.id()).ljust(78,'-'))
36+ self.stream.write('\n')
37+ self.stream.write(log_contents)
38+ self.stream.write('\n')
39+ self.stream.write(
40+ ('^^^^[log from %s]' % test.id()).ljust(78,'-'))
41+ self.stream.write('\n')
42 self.stream.writeln(self.separator2)
43 self.stream.writeln("%s" % err)
44
45@@ -486,11 +486,11 @@
46 def report_test_start(self, test):
47 self.count += 1
48 name = self._shortened_test_description(test)
49- # width needs space for 6 char status, plus 1 for slash, plus 2 10-char
50- # numbers, plus a trailing blank
51+ # width needs space for 6 char status, plus 1 for slash, plus an
52+ # 11-char time string, plus a trailing blank
53 # when NUMBERED_DIRS: plus 5 chars on test number, plus 1 char on space
54 self.stream.write(self._ellipsize_to_right(name,
55- osutils.terminal_width()-30))
56+ osutils.terminal_width()-18))
57 self.stream.flush()
58
59 def _error_summary(self, err):
60
61=== modified file 'bzrlib/tests/test_selftest.py'
62--- bzrlib/tests/test_selftest.py 2009-07-10 10:46:00 +0000
63+++ bzrlib/tests/test_selftest.py 2009-07-20 04:35:45 +0000
64@@ -723,9 +723,10 @@
65 self.time(time.sleep, 0.003)
66 self.check_timing(ShortDelayTestCase('test_short_delay'),
67 r"^ +[0-9]+ms$")
68- # if a benchmark time is given, we want a x of y style result.
69+ # if a benchmark time is given, we now show just that time followed by
70+ # a star
71 self.check_timing(ShortDelayTestCase('test_short_benchmark'),
72- r"^ +[0-9]+ms/ +[0-9]+ms$")
73+ r"^ +[0-9]+ms\*$")
74
75 def test_unittest_reporting_unittest_class(self):
76 # getting the time from a non-bzrlib test works ok
77@@ -943,7 +944,7 @@
78 result.report_unsupported(test, feature)
79 output = result_stream.getvalue()[prefix:]
80 lines = output.splitlines()
81- self.assertEqual(lines, ['NODEP 0ms',
82+ self.assertEqual(lines, ['NODEP 0ms',
83 " The feature 'Feature' is not available."])
84
85 def test_text_report_unsupported(self):
86@@ -1490,7 +1491,7 @@
87 sample_test.run(result)
88 self.assertContainsRe(
89 output_stream.getvalue(),
90- r"\d+ms/ +\d+ms\n$")
91+ r"\d+ms\*\n$")
92
93 def test_hooks_sanitised(self):
94 """The bzrlib hooks should be sanitised by setUp."""