~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/__init__.py

[merge] robert

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)