~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

Use full terminal width for verbose test output.

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
    Shows output in a different format, including displaying runtime for tests.
70
70
    """
71
71
 
72
 
    # assumes 80-column window, less 'ERROR 99999ms' = 13ch
73
72
    def _elapsedTime(self):
74
73
        return "%5dms" % (1000 * (time.time() - self._start_time))
75
74
 
79
78
        # the beginning, but in an id, the important words are
80
79
        # at the end
81
80
        SHOW_DESCRIPTIONS = False
82
 
        what = SHOW_DESCRIPTIONS and test.shortDescription()
83
 
        if what:
84
 
            if len(what) > 65:
85
 
                what = what[:62] + '...'
86
 
        else:
87
 
            what = test.id()
88
 
            if what.startswith('bzrlib.tests.'):
89
 
                what = what[13:]
90
 
            if len(what) > 65:
91
 
                what = '...' + what[-62:]
92
81
        if self.showAll:
93
 
            self.stream.write('%-65.65s' % what)
 
82
            width = osutils.terminal_width()
 
83
            name_width = width - 15
 
84
            what = None
 
85
            if SHOW_DESCRIPTIONS:
 
86
                what = test.shortDescription()
 
87
                if what:
 
88
                    if len(what) > name_width:
 
89
                        what = what[:name_width-3] + '...'
 
90
            if what is None:
 
91
                what = test.id()
 
92
                if what.startswith('bzrlib.tests.'):
 
93
                    what = what[13:]
 
94
                if len(what) > name_width:
 
95
                    what = '...' + what[3-name_width:]
 
96
            what = what.ljust(name_width)
 
97
            self.stream.write(what)
94
98
        self.stream.flush()
95
99
        self._start_time = time.time()
96
100