/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: John Arbash Meinel
  • Date: 2010-09-24 16:53:27 UTC
  • mto: This revision was merged to the branch mainline in revision 5445.
  • Revision ID: john@arbash-meinel.com-20100924165327-54m2jfhmz5mo69b3
add a failing test that the subunit stream doesn't contain the log info.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1739
1739
        details = test.getDetails()
1740
1740
        self.assertTrue('log' in details)
1741
1741
 
1742
 
    # def test_success_has_no_log(self):
1743
 
    #     # TODO: We need to test the Subunit implementation here
1744
 
    #     class Test(tests.TestCase):
1745
 
    #         def test_success(self):
1746
 
    #             mutter('this test succeeded')
1747
 
    #     result = self._run_test(Test('test_success'))
1748
 
    #     self.assertEqual(1, len(result.errors))
1749
 
    #     result_content = result.errors[0][1]
1750
 
    #     self.assertContainsRe(result_content, 'Text attachment: log')
1751
 
    #     self.assertContainsRe(result_content, 'this test errored')
1752
 
 
1753
1742
 
1754
1743
# NB: Don't delete this; it's not actually from 0.11!
1755
1744
@deprecated_function(deprecated_in((0, 11, 0)))
1910
1899
                tree.branch.repository.bzrdir.root_transport)
1911
1900
 
1912
1901
 
1913
 
class SelfTestHelper:
 
1902
class SelfTestHelper(object):
1914
1903
 
1915
1904
    def run_selftest(self, **kwargs):
1916
1905
        """Run selftest returning its output."""
2067
2056
            load_list='missing file name', list_only=True)
2068
2057
 
2069
2058
 
 
2059
class TestSubunitLogDetails(tests.TestCase, SelfTestHelper):
 
2060
 
 
2061
    _test_needs_features = [features.subunit]
 
2062
 
 
2063
    def run_subunit_stream(self, test_suite_factory):
 
2064
        from subunit import ProtocolTestCase
 
2065
        stream = self.run_selftest(runner_class=tests.SubUnitBzrRunner,
 
2066
            test_suite_factory=test_suite_factory)
 
2067
        test = ProtocolTestCase(stream)
 
2068
        result = unittest.TestResult()
 
2069
        test.run(result)
 
2070
        return stream, result
 
2071
 
 
2072
    def test_success_has_no_log(self):
 
2073
        class Test(tests.TestCase):
 
2074
            def test_success(self):
 
2075
                mutter('this test succeeds')
 
2076
        def factory():
 
2077
            return TestUtil.TestSuite([Test('test_success')])
 
2078
        stream, result = self.run_subunit_stream(factory)
 
2079
        self.assertEqual(1, result.testsRun)
 
2080
        content = stream.getvalue()
 
2081
        self.assertNotContainsRe(content, '(?m)^log$')
 
2082
        self.assertNotContainsRe(content, 'this test succeeds')
 
2083
 
 
2084
 
2070
2085
class TestRunBzr(tests.TestCase):
2071
2086
 
2072
2087
    out = ''