~jelmer/ubuntu/maverick/bzr/2.2.5

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2009-03-10 14:11:59 UTC
  • mfrom: (1.2.1 upstream) (3.1.68 jaunty)
  • Revision ID: james.westby@ubuntu.com-20090310141159-lwzzo5c1fwrtzgj4
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
141
141
        # test that the stdin keyword to run_bzr is passed through to
142
142
        # _run_bzr_core as-is. We do this by overriding
143
143
        # _run_bzr_core in this class, and then calling run_bzr,
144
 
        # which is a convenience function for _run_bzr_core, so 
 
144
        # which is a convenience function for _run_bzr_core, so
145
145
        # should invoke it.
146
146
        self.run_bzr('foo bar', stdin='gam')
147
147
        self.assertEqual('gam', self.stdin)
208
208
        # test that the stdin keyword to _run_bzr_core is passed through to
209
209
        # apply_redirected as a StringIO. We do this by overriding
210
210
        # apply_redirected in this class, and then calling _run_bzr_core,
211
 
        # which calls apply_redirected. 
 
211
        # which calls apply_redirected.
212
212
        self.run_bzr(['foo', 'bar'], stdin='gam')
213
213
        self.assertEqual('gam', self.stdin.read())
214
214
        self.assertTrue(self.stdin is self.factory_stdin)
257
257
class TestRunBzrSubprocess(TestCaseWithTransport):
258
258
 
259
259
    def test_run_bzr_subprocess(self):
260
 
        """The run_bzr_helper_external comand behaves nicely."""
 
260
        """The run_bzr_helper_external command behaves nicely."""
261
261
        result = self.run_bzr_subprocess('--version')
262
262
        result = self.run_bzr_subprocess(['--version'])
263
263
        result = self.run_bzr_subprocess('--version', retcode=None)
264
264
        self.assertContainsRe(result[0], 'is free software')
265
 
        self.assertRaises(AssertionError, self.run_bzr_subprocess, 
 
265
        self.assertRaises(AssertionError, self.run_bzr_subprocess,
266
266
                          '--versionn')
267
267
        result = self.run_bzr_subprocess('--versionn', retcode=3)
268
268
        result = self.run_bzr_subprocess('--versionn', retcode=None)
428
428
        process = self.start_bzr_subprocess(['--versionn'])
429
429
        self.assertRaises(self.failureException, self.finish_bzr_subprocess,
430
430
                          process)
431
 
        
 
431
 
432
432
    def test_start_and_stop_bzr_subprocess_send_signal(self):
433
433
        """finish_bzr_subprocess raises self.failureException if the retcode is
434
434
        not the expected one.
568
568
    def test_load_unknown(self):
569
569
        out, err = self.run_bzr('selftest --load-list I_do_not_exist ',
570
570
                                retcode=3)
 
571
 
 
572
 
 
573
class TestSelftestStartingWith(TestCase):
 
574
 
 
575
    def test_starting_with_single_argument(self):
 
576
        out, err = self.run_bzr(
 
577
            ['selftest', '--starting-with', self.id(), '--list'])
 
578
        self.assertContainsRe(out, "Listed 1 test in")
 
579
        self.assertContainsRe(out, self.id())
 
580
 
 
581
    def test_starting_with_multiple_argument(self):
 
582
        out, err = self.run_bzr(
 
583
            ['selftest',
 
584
             '--starting-with', self.id(),
 
585
             '--starting-with', 'bzrlib.tests.test_sampler',
 
586
             '--list'])
 
587
        self.assertContainsRe(out, "Listed 2 tests in")
 
588
        self.assertContainsRe(out, self.id())
 
589
        self.assertContainsRe(out, 'bzrlib.tests.test_sampler')