[MERGE] several tweaks for formatting selftest output

John Arbash Meinel john at arbash-meinel.com
Tue Dec 12 14:55:16 GMT 2006


Alexander Belchenko wrote:
> John Arbash Meinel ?8H5B:
>>> Alexander Belchenko wrote:
>>>> In bzr 0.12 and early 'selftest -v' use osutils.terminal_width() to
>>>> format report. Now it's gone.
>>>>
>>>> The line in question is:
>>>>
>>>> self.stream.write(self._ellipsize_to_right(name, 60))
>>>>
>>>> in method report_test_start() in class VerboseTestResult.
>>>> This change introduced by
>>>> revid:mbp at sourcefrog.net-20061029065311-c0db791096b06831.
>>>>
>>>> I think using hardwired value 60 to format report is not good.
>>>> But probably Martin has some strong reasons to do this?
>>>>
>>>> I'd like to switch hardwired 60 to (osutils.terminal_width()-20).
>>> Sounds reasonable to me.
> 
> Here the patch.
> 
> Alexander
> 


v- I would probably prefer:

self.stream.write(self._ellipsize_to_right(name,
                  osutils.terminal_width()-20))

It is a small thing, but as long as the terminal_width() overhead is
small, it does mean that you can change the width of the terminal and
have the lines get wider/smaller. It is something that I kind of like
with selftest --verbose.


     def extractBenchmarkTime(self, testCase):
@@ -376,7 +377,8 @@
     def report_test_start(self, test):
         self.count += 1
         name = self._shortened_test_description(test)
-        self.stream.write(self._ellipsize_to_right(name, 60))
+        self.stream.write(self._ellipsize_to_right(name,
+                                                   self.terminal_width-20))
         self.stream.flush()

     def report_error(self, test, err):
@@ -386,7 +388,7 @@

     def report_failure(self, test, err):
         self.failure_count += 1
-        self.stream.writeln('FAIL %s\n    %s'
+        self.stream.writeln(' FAIL %s\n    %s'
                 % (self._testTimeString(), err[1]))

     def report_success(self, test):


^ Why are you changing FAIL? Is it just to line up with ERROR and SKIP?
It seems good, I just haven't seen it mentioned. (Maybe I just missed it).

Otherwise +1.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061212/dc078060/attachment.pgp 


More information about the bazaar mailing list