360
360
self.assertEqual(cwd, osutils.getcwd())
363
class _DontSpawnProcess(Exception):
364
"""A simple exception which just allows us to skip unnecessary steps"""
367
class TestRunBzrSubprocessCommands(TestCaseWithTransport):
369
def _popen(self, *args, **kwargs):
370
"""Record the command that is run, so that we can ensure it is correct"""
371
self._popen_args = args
372
self._popen_kwargs = kwargs
373
raise _DontSpawnProcess()
375
def test_run_bzr_subprocess_no_plugins(self):
376
self.assertRaises(_DontSpawnProcess, self.run_bzr_subprocess)
377
command = self._popen_args[0]
378
self.assertEqual(sys.executable, command[0])
379
self.assertEqual(self.get_bzr_path(), command[1])
380
self.assertEqual(['--no-plugins'], command[2:])
382
def test_allow_plugins(self):
383
self.assertRaises(_DontSpawnProcess,
384
self.run_bzr_subprocess, allow_plugins=True)
385
command = self._popen_args[0]
386
self.assertEqual([], command[2:])
363
389
class TestBzrSubprocess(TestCaseWithTransport):
365
391
def test_start_and_stop_bzr_subprocess(self):