1
# Copyright (C) 2005 by Canonical Ltd
1
# Copyright (C) 2005 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License version 2 as published by
5
# the Free Software Foundation.
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
8
# This program is distributed in the hope that it will be useful,
8
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
173
174
TestCaseWithMemoryTransport.TEST_ROOT = old_root
174
175
self.assertContainsRe(out, 'Ran 0 tests.*\n\nOK')
175
176
self.assertEqual(
176
'running tests...\ntests passed\n',
178
179
benchfile = open(".perf_history", "rt")
359
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:])
362
389
class TestBzrSubprocess(TestCaseWithTransport):
364
391
def test_start_and_stop_bzr_subprocess(self):