/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: Martin Pool
  • Date: 2007-08-20 09:17:50 UTC
  • mto: (2729.2.3 inv-refactor)
  • mto: This revision was merged to the branch mainline in revision 2758.
  • Revision ID: mbp@sourcefrog.net-20070820091750-n8fz1x3bml1r95oq
Add TestNotApplicable exception and handling of it; document test parameterization

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
                          TestCaseInTempDir,
49
49
                          TestCaseWithMemoryTransport,
50
50
                          TestCaseWithTransport,
 
51
                          TestNotApplicable,
51
52
                          TestSkipped,
52
53
                          TestSuite,
53
54
                          TestUtil,
1134
1135
        # Check if cleanup was called the right number of times.
1135
1136
        self.assertEqual(0, test.counter)
1136
1137
 
 
1138
    def test_not_applicable(self):
 
1139
        # run a test that is skipped because it's not applicable
 
1140
        def not_applicable_test():
 
1141
            from bzrlib.tests import TestNotApplicable
 
1142
            raise TestNotApplicable('this test never runs')
 
1143
        out = StringIO()
 
1144
        runner = TextTestRunner(stream=out, verbosity=2)
 
1145
        test = unittest.FunctionTestCase(not_applicable_test)
 
1146
        result = self.run_test_runner(runner, test)
 
1147
        self._log_file.write(out.getvalue())
 
1148
        self.assertTrue(result.wasSuccessful())
 
1149
        self.assertTrue(result.wasStrictlySuccessful())
 
1150
        self.assertContainsRe(out.getvalue(),
 
1151
                r'(?m)not_applicable_test   * N/A')
 
1152
        self.assertContainsRe(out.getvalue(),
 
1153
                r'(?m)^    this test never runs')
 
1154
 
 
1155
    def test_not_applicable_demo(self):
 
1156
        # just so you can see it in the test output
 
1157
        raise TestNotApplicable('this test is just a demonstation')
 
1158
 
1137
1159
    def test_unsupported_features_listed(self):
1138
1160
        """When unsupported features are encountered they are detailed."""
1139
1161
        class Feature1(Feature):