/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

Merge Martins 0.15rc2 release branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
718
718
        # skipping_test must be hidden in here so it's not run as a real test
719
719
        def skipping_test():
720
720
            raise TestSkipped('test intentionally skipped')
 
721
 
721
722
        runner = TextTestRunner(stream=self._log_file, keep_output=True)
722
723
        test = unittest.FunctionTestCase(skipping_test)
723
724
        result = self.run_test_runner(runner, test)
724
725
        self.assertTrue(result.wasSuccessful())
725
726
 
 
727
    def test_skipped_from_setup(self):
 
728
        class SkippedSetupTest(TestCase):
 
729
 
 
730
            def setUp(self):
 
731
                self.counter = 1
 
732
                self.addCleanup(self.cleanup)
 
733
                raise TestSkipped('skipped setup')
 
734
 
 
735
            def test_skip(self):
 
736
                self.fail('test reached')
 
737
 
 
738
            def cleanup(self):
 
739
                self.counter -= 1
 
740
 
 
741
        runner = TextTestRunner(stream=self._log_file, keep_output=True)
 
742
        test = SkippedSetupTest('test_skip')
 
743
        result = self.run_test_runner(runner, test)
 
744
        self.assertTrue(result.wasSuccessful())
 
745
        # Check if cleanup was called the right number of times.
 
746
        self.assertEqual(0, test.counter)
 
747
 
 
748
    def test_skipped_from_test(self):
 
749
        class SkippedTest(TestCase):
 
750
 
 
751
            def setUp(self):
 
752
                self.counter = 1
 
753
                self.addCleanup(self.cleanup)
 
754
 
 
755
            def test_skip(self):
 
756
                raise TestSkipped('skipped test')
 
757
 
 
758
            def cleanup(self):
 
759
                self.counter -= 1
 
760
 
 
761
        runner = TextTestRunner(stream=self._log_file, keep_output=True)
 
762
        test = SkippedTest('test_skip')
 
763
        result = self.run_test_runner(runner, test)
 
764
        self.assertTrue(result.wasSuccessful())
 
765
        # Check if cleanup was called the right number of times.
 
766
        self.assertEqual(0, test.counter)
 
767
 
726
768
    def test_bench_history(self):
727
769
        # tests that the running the benchmark produces a history file
728
770
        # containing a timestamp and the revision id of the bzrlib source which