/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Aaron Bentley
  • Date: 2009-12-07 21:46:28 UTC
  • mfrom: (4871 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4873.
  • Revision ID: aaron@aaronbentley.com-20091207214628-yifwgux0fn4x3bo4
Merge bzr.dev into merge-i-lock.

Show diffs side-by-side

added added

removed removed

Lines of Context:
533
533
    def report_test_start(self, test):
534
534
        self.count += 1
535
535
        name = self._shortened_test_description(test)
536
 
        # width needs space for 6 char status, plus 1 for slash, plus an
537
 
        # 11-char time string, plus a trailing blank
538
 
        # when NUMBERED_DIRS: plus 5 chars on test number, plus 1 char on space
539
 
        self.stream.write(self._ellipsize_to_right(name,
540
 
                          osutils.terminal_width()-18))
 
536
        width = osutils.terminal_width()
 
537
        if width is not None:
 
538
            # width needs space for 6 char status, plus 1 for slash, plus an
 
539
            # 11-char time string, plus a trailing blank
 
540
            # when NUMBERED_DIRS: plus 5 chars on test number, plus 1 char on
 
541
            # space
 
542
            self.stream.write(self._ellipsize_to_right(name, width-18))
 
543
        else:
 
544
            self.stream.write(name)
541
545
        self.stream.flush()
542
546
 
543
547
    def _error_summary(self, err):
1524
1528
            'BZR_PROGRESS_BAR': None,
1525
1529
            'BZR_LOG': None,
1526
1530
            'BZR_PLUGIN_PATH': None,
 
1531
            'BZR_CONCURRENCY': None,
1527
1532
            # Make sure that any text ui tests are consistent regardless of
1528
1533
            # the environment the test case is run in; you may want tests that
1529
1534
            # test other combinations.  'dumb' is a reasonable guess for tests
1531
1536
            'TERM': 'dumb',
1532
1537
            'LINES': '25',
1533
1538
            'COLUMNS': '80',
 
1539
            'BZR_COLUMNS': '80',
1534
1540
            # SSH Agent
1535
1541
            'SSH_AUTH_SOCK': None,
1536
1542
            # Proxies
2405
2411
            # recreate a new one or all the followng tests will fail.
2406
2412
            # If you need to inspect its content uncomment the following line
2407
2413
            # import pdb; pdb.set_trace()
2408
 
            _rmtree_temp_dir(root + '/.bzr')
 
2414
            _rmtree_temp_dir(root + '/.bzr', test_id=self.id())
2409
2415
            self._create_safety_net()
2410
2416
            raise AssertionError('%s/.bzr should not be modified' % root)
2411
2417
 
2603
2609
 
2604
2610
    def deleteTestDir(self):
2605
2611
        os.chdir(TestCaseWithMemoryTransport.TEST_ROOT)
2606
 
        _rmtree_temp_dir(self.test_base_dir)
 
2612
        _rmtree_temp_dir(self.test_base_dir, test_id=self.id())
2607
2613
 
2608
2614
    def build_tree(self, shape, line_endings='binary', transport=None):
2609
2615
        """Build a test tree according to a pattern.
4131
4137
    return new_test
4132
4138
 
4133
4139
 
4134
 
def _rmtree_temp_dir(dirname):
 
4140
def _rmtree_temp_dir(dirname, test_id=None):
4135
4141
    # If LANG=C we probably have created some bogus paths
4136
4142
    # which rmtree(unicode) will fail to delete
4137
4143
    # so make sure we are using rmtree(str) to delete everything
4149
4155
        # We don't want to fail here because some useful display will be lost
4150
4156
        # otherwise. Polluting the tmp dir is bad, but not giving all the
4151
4157
        # possible info to the test runner is even worse.
 
4158
        if test_id != None:
 
4159
            ui.ui_factory.clear_term()
 
4160
            sys.stderr.write('\nWhile running: %s\n' % (test_id,))
4152
4161
        sys.stderr.write('Unable to remove testing dir %s\n%s'
4153
4162
                         % (os.path.basename(dirname), e))
4154
4163