~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2007-06-26 13:49:44 UTC
  • mto: (2581.1.1 cleanup-runbzr)
  • mto: This revision was merged to the branch mainline in revision 2588.
  • Revision ID: v.ladeuil+lp@free.fr-20070626134944-snlh5i0zsa30mysx
Enforce run_bzr(string) where possible.

Show diffs side-by-side

added added

removed removed

Lines of Context:
184
184
        try:
185
185
            TestCaseWithMemoryTransport.TEST_ROOT = None
186
186
            out, err = self.run_bzr(['selftest', '--benchmark',
187
 
                'workingtree_implementations'])
 
187
                                     'workingtree_implementations'])
188
188
        finally:
189
189
            TestCaseWithMemoryTransport.TEST_ROOT = old_root
190
190
        self.assertContainsRe(out, 'Ran 0 tests.*\n\nOK')
491
491
                           'test9999.tmp','tests'],
492
492
                           before)
493
493
 
494
 
        out, err = self.run_bzr(['selftest','--clean-output'],
495
 
                                        working_dir=root)
 
494
        out, err = self.run_bzr('selftest --clean-output',
 
495
                                working_dir=root)
496
496
 
497
497
        self.assertEquals(['delete directory: test0000.tmp',
498
498
                          'delete directory: test0001.tmp'],
540
540
 
541
541
    def test_list_only(self):
542
542
        # check that bzr selftest --list-only works correctly
543
 
        out,err = self.run_bzr(['selftest', 'selftest',
544
 
            '--list-only'])
 
543
        out,err = self.run_bzr('selftest selftest --list-only')
545
544
        self.assertEndsWith(err, 'tests passed\n')
546
545
        (header,body,footer) = self._parse_test_list(out.splitlines())
547
546
        num_tests = len(body)
549
548
 
550
549
    def test_list_only_filtered(self):
551
550
        # check that a filtered --list-only works, both include and exclude
552
 
        out_all,err_all = self.run_bzr(['selftest', '--list-only'])
 
551
        out_all,err_all = self.run_bzr('selftest --list-only')
553
552
        tests_all = self._parse_test_list(out_all.splitlines())[1]
554
 
        out_incl,err_incl = self.run_bzr(['selftest', '--list-only',
555
 
          'selftest'])
 
553
        out_incl,err_incl = self.run_bzr('selftest --list-only selftest')
556
554
        tests_incl = self._parse_test_list(out_incl.splitlines())[1]
557
555
        self.assertSubset(tests_incl, tests_all)
558
556
        out_excl,err_excl = self.run_bzr(['selftest', '--list-only',
559
 
          '--exclude', 'selftest'])
 
557
                                          '--exclude', 'selftest'])
560
558
        tests_excl = self._parse_test_list(out_excl.splitlines())[1]
561
559
        self.assertSubset(tests_excl, tests_all)
562
560
        set_incl = set(tests_incl)
567
565
 
568
566
    def test_list_only_random(self):
569
567
        # check that --randomize works correctly
570
 
        out_all,err_all = self.run_bzr(['selftest', '--list-only',
571
 
            'selftest'])
 
568
        out_all,err_all = self.run_bzr('selftest --list-only selftest')
572
569
        tests_all = self._parse_test_list(out_all.splitlines())[1]
573
570
        # XXX: It looks like there are some orders for generating tests that
574
571
        # fail as of 20070504 - maybe because of import order dependencies.
575
572
        # So unfortunately this will rarely intermittently fail at the moment.
576
573
        # -- mbp 20070504
577
574
        out_rand,err_rand = self.run_bzr(['selftest', '--list-only',
578
 
            'selftest', '--randomize', 'now'])
 
575
                                          'selftest', '--randomize', 'now'])
579
576
        (header_rand,tests_rand,dummy) = self._parse_test_list(
580
577
            out_rand.splitlines(), 2)
581
578
        self.assertNotEqual(tests_all, tests_rand)
585
582
        match_obj = seed_re.search(header_rand[-1])
586
583
        seed = match_obj.group(1)
587
584
        out_rand2,err_rand2 = self.run_bzr(['selftest', '--list-only',
588
 
            'selftest', '--randomize', seed])
 
585
                                            'selftest', '--randomize', seed])
589
586
        (header_rand2,tests_rand2,dummy) = self._parse_test_list(
590
587
            out_rand2.splitlines(), 2)
591
588
        self.assertEqual(tests_rand, tests_rand2)