~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/__init__.py

Merged Martin

Show diffs side-by-side

added added

removed removed

Lines of Context:
301
301
        else:
302
302
            return self._log_contents
303
303
 
304
 
    def capture(self, cmd):
 
304
    def capture(self, cmd, retcode=0):
305
305
        """Shortcut that splits cmd into words, runs, and returns stdout"""
306
 
        return self.run_bzr_captured(cmd.split())[0]
 
306
        return self.run_bzr_captured(cmd.split(), retcode=retcode)[0]
307
307
 
308
308
    def run_bzr_captured(self, argv, retcode=0):
309
309
        """Invoke bzr and return (stdout, stderr).
473
473
        self.test_dir = os.path.join(self.TEST_ROOT, short_id)
474
474
        os.mkdir(self.test_dir)
475
475
        os.chdir(self.test_dir)
 
476
        os.environ['HOME'] = self.test_dir
476
477
        def _leaveDirectory():
477
478
            os.chdir(_currentdir)
478
479
        self.addCleanup(_leaveDirectory)
487
488
        """
488
489
        # XXX: It's OK to just create them using forward slashes on windows?
489
490
        for name in shape:
490
 
            assert isinstance(name, basestring)
 
491
            self.assert_(isinstance(name, basestring))
491
492
            if name[-1] == '/':
492
493
                os.mkdir(name[:-1])
493
494
            else:
514
515
        logging.info('an info message')
515
516
        warning('something looks dodgy...')
516
517
        logging.debug('hello, test is running')
517
 
        ## assert 0
518
518
 
519
519
 
520
520
def filter_suite_by_re(suite, pattern):