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)
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,
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',
157
self.assertContainsRe(err, 'No known merge type magic merge')
160
class TestRunBzrError(ExternalBase):
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')
166
out, err = self.run_bzr_error(["'foobarbaz' is not a versioned file"],
167
'file-id', 'foobarbaz')