~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

merge from mbp.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import os
20
20
import sys
 
21
import unittest
21
22
 
22
 
from bzrlib.tests import TestCase, _load_module_by_name
 
23
from bzrlib.tests import TestCase, _load_module_by_name, \
 
24
        TestSkipped
 
25
import bzrlib.tests
23
26
 
24
27
 
25
28
class SelftestTests(TestCase):
40
43
        self.log('a test message')
41
44
        self._log_file.flush()
42
45
        self.assertContainsRe(self._get_log(), 'a test message\n')
 
46
 
 
47
 
 
48
class TestSkippedTest(TestCase):
 
49
    """Try running a test which is skipped, make sure it's reported properly."""
 
50
    def test_skipped_test(self):
 
51
        # must be hidden in here so it's not run as a real test
 
52
        def skipping_test():
 
53
            raise TestSkipped('test intentionally skipped')
 
54
        runner = bzrlib.tests.TextTestRunner(stream=self._log_file)
 
55
        test = unittest.FunctionTestCase(skipping_test)
 
56
        result = runner.run(test)
 
57
        self.assertTrue(result.wasSuccessful())