~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2006-11-02 10:20:19 UTC
  • mfrom: (2114 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2119.
  • Revision ID: mbp@sourcefrog.net-20061102102019-9a5a02f485dff6f6
merge bzr.dev and reconcile several changes, also some test fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 by Canonical Ltd
 
1
# Copyright (C) 2005 Canonical Ltd
2
2
#
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.
6
7
#
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',
 
177
            'tests passed\n',
177
178
            err)
178
179
        benchfile = open(".perf_history", "rt")
179
180
        try:
359
360
        self.assertEqual(cwd, osutils.getcwd())
360
361
 
361
362
 
 
363
class _DontSpawnProcess(Exception):
 
364
    """A simple exception which just allows us to skip unnecessary steps"""
 
365
 
 
366
 
 
367
class TestRunBzrSubprocessCommands(TestCaseWithTransport):
 
368
 
 
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()
 
374
 
 
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:])
 
381
 
 
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:])
 
387
 
 
388
 
362
389
class TestBzrSubprocess(TestCaseWithTransport):
363
390
 
364
391
    def test_start_and_stop_bzr_subprocess(self):