~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-12-19 06:58:55 UTC
  • mfrom: (2196.1.2 benchmark-formatting)
  • Revision ID: pqm@pqm.ubuntu.com-20061219065855-deb1b86e0b392f15
(mbp) fix line width and abbreviation in benchmark progress (trivial)

Show diffs side-by-side

added added

removed removed

Lines of Context:
192
192
                self._formatTime(self._benchmarkTime),
193
193
                self._elapsedTestTimeString())
194
194
        else:
195
 
            return "      %s" % self._elapsedTestTimeString()
 
195
            return "           %s" % self._elapsedTestTimeString()
196
196
 
197
197
    def _formatTime(self, seconds):
198
198
        """Format seconds as milliseconds with leading spaces."""
199
 
        return "%5dms" % (1000 * seconds)
 
199
        # some benchmarks can take thousands of seconds to run, so we need 8
 
200
        # places
 
201
        return "%8dms" % (1000 * seconds)
200
202
 
201
203
    def _shortened_test_description(self, test):
202
204
        what = test.id()
203
 
        what = re.sub(r'^bzrlib\.(tests|benchmark)\.', '', what)
 
205
        what = re.sub(r'^bzrlib\.(tests|benchmarks)\.', '', what)
204
206
        return what
205
207
 
206
208
    def startTest(self, test):
376
378
    def report_test_start(self, test):
377
379
        self.count += 1
378
380
        name = self._shortened_test_description(test)
 
381
        # width needs space for 6 char status, plus 1 for slash, plus 2 10-char
 
382
        # numbers, plus a trailing blank
379
383
        self.stream.write(self._ellipsize_to_right(name,
380
 
                            osutils.terminal_width()-20))
 
384
                            osutils.terminal_width()-30))
381
385
        self.stream.flush()
382
386
 
383
387
    def report_error(self, test, err):