~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_selftest.py

merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
141
141
        self.assertEqual('foo\n', self.factory.stdout.getvalue())
142
142
        self.assertEqual('bar\n', self.factory.stderr.getvalue())
143
143
        self.assertIsInstance(self.factory, bzrlib.tests.blackbox.TestUIFactory)
 
144
 
 
145
    def test_run_bzr_subprocess(self):
 
146
        """The run_bzr_helper_external comand behaves nicely."""
 
147
        result = self.run_bzr_subprocess('--version')
 
148
        result = self.run_bzr_subprocess('--version', retcode=None)
 
149
        self.assertContainsRe(result[0], 'is free software')
 
150
        self.assertRaises(AssertionError, self.run_bzr_subprocess, 
 
151
                          '--versionn')
 
152
        result = self.run_bzr_subprocess('--versionn', retcode=3)
 
153
        result = self.run_bzr_subprocess('--versionn', retcode=None)
 
154
        self.assertContainsRe(result[1], 'unknown command')
 
155
        err = self.run_bzr_subprocess('merge', '--merge-type', 'magic merge', 
 
156
                                      retcode=3)[1]
 
157
        self.assertContainsRe(err, 'No known merge type magic merge')
 
158
 
 
159
 
 
160
class TestRunBzrError(ExternalBase):
 
161
 
 
162
    def test_run_bzr_error(self):
 
163
        out, err = self.run_bzr_error(['^$'], 'rocks', retcode=0)
 
164
        self.assertEqual(out, 'it sure does!\n')
 
165
 
 
166
        out, err = self.run_bzr_error(["'foobarbaz' is not a versioned file"],
 
167
                                      'file-id', 'foobarbaz')