~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

MergeĀ fromĀ upstream.

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, TestCaseInTempDir, _load_module_by_name
 
23
from bzrlib.tests import (
 
24
                          _load_module_by_name,
 
25
                          TestCase,
 
26
                          TestCaseInTempDir,
 
27
                          TestSkipped,
 
28
                          TextTestRunner,
 
29
                          )
23
30
 
24
31
 
25
32
class SelftestTests(TestCase):
49
56
        filename = u'hell\u00d8'
50
57
        self.build_tree_contents([(filename, 'contents of hello')])
51
58
        self.failUnlessExists(filename)
 
59
 
 
60
 
 
61
class TestSkippedTest(TestCase):
 
62
    """Try running a test which is skipped, make sure it's reported properly."""
 
63
    def test_skipped_test(self):
 
64
        # must be hidden in here so it's not run as a real test
 
65
        def skipping_test():
 
66
            raise TestSkipped('test intentionally skipped')
 
67
        runner = TextTestRunner(stream=self._log_file)
 
68
        test = unittest.FunctionTestCase(skipping_test)
 
69
        result = runner.run(test)
 
70
        self.assertTrue(result.wasSuccessful())