/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

  • Committer: Robert Collins
  • Date: 2009-04-08 13:29:00 UTC
  • mto: (4276.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4277.
  • Revision ID: robertc@robertcollins.net-20090408132900-0wvutu89y32oyov3
Move test prelude and suffix output to ExtendedTestResult

Show diffs side-by-side

added added

removed removed

Lines of Context:
836
836
    def test_known_failure(self):
837
837
        """A KnownFailure being raised should trigger several result actions."""
838
838
        class InstrumentedTestResult(ExtendedTestResult):
839
 
 
 
839
            def done(self): pass
 
840
            def startTests(self): pass
840
841
            def report_test_start(self, test): pass
841
842
            def report_known_failure(self, test, err):
842
843
                self._call = test, err
884
885
        # text test output formatting
885
886
        pb = MockProgress()
886
887
        result = bzrlib.tests.TextTestResult(
887
 
            None,
 
888
            StringIO(),
888
889
            descriptions=0,
889
890
            verbosity=1,
890
891
            pb=pb,
924
925
    def test_add_not_supported(self):
925
926
        """Test the behaviour of invoking addNotSupported."""
926
927
        class InstrumentedTestResult(ExtendedTestResult):
 
928
            def done(self): pass
 
929
            def startTests(self): pass
927
930
            def report_test_start(self, test): pass
928
931
            def report_unsupported(self, test, feature):
929
932
                self._call = test, feature
966
969
        # text test output formatting
967
970
        pb = MockProgress()
968
971
        result = bzrlib.tests.TextTestResult(
969
 
            None,
 
972
            StringIO(),
970
973
            descriptions=0,
971
974
            verbosity=1,
972
975
            pb=pb,
994
997
    def test_unavailable_exception(self):
995
998
        """An UnavailableFeature being raised should invoke addNotSupported."""
996
999
        class InstrumentedTestResult(ExtendedTestResult):
997
 
 
 
1000
            def done(self): pass
 
1001
            def startTests(self): pass
998
1002
            def report_test_start(self, test): pass
999
1003
            def addNotSupported(self, test, feature):
1000
1004
                self._call = test, feature
1094
1098
            '----------------------------------------------------------------------',
1095
1099
            '',
1096
1100
            'FAILED (failures=1, known_failure_count=1)'],
1097
 
            lines[0:5] + lines[6:10] + lines[11:])
 
1101
            lines[3:8] + lines[9:13] + lines[14:])
1098
1102
 
1099
1103
    def test_known_failure_ok_run(self):
1100
1104
        # run a test that generates a known failure which should be printed in the final output.
2348
2352
                calls.append(test)
2349
2353
                return ExtendedTestResult(self.stream, self.descriptions,
2350
2354
                    self.verbosity)
2351
 
        run_suite(suite, runner_class=MyRunner)
 
2355
        run_suite(suite, runner_class=MyRunner, stream=StringIO())
2352
2356
        self.assertEqual(calls, [suite])