/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 bzr.dev

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