~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

(gz) Accept new style testtools output in bt.test_selftest tests (Martin
 Packman)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1095
1095
            "FAIL: \\S+\.test_truth\n"
1096
1096
            "-+\n"
1097
1097
            "(?:.*\n)*"
1098
 
            "No absolute truth\n"
 
1098
            "\\s*(?:Text attachment: )?reason"
 
1099
            "(?:\n-+\n|: {{{)"
 
1100
            "No absolute truth"
 
1101
            "(?:\n-+\n|}}}\n)"
1099
1102
            "(?:.*\n)*"
1100
1103
            "-+\n"
1101
1104
            "Ran 1 test in .*\n"
1266
1269
        result = self.run_test_runner(tests.TextTestRunner(stream=out),
1267
1270
            FailureWithUnicode("test_log_unicode"))
1268
1271
        self.assertContainsRe(out.getvalue(),
1269
 
            "Text attachment: log\n"
1270
 
            "-+\n"
1271
 
            "\d+\.\d+  \\\\u2606\n"
1272
 
            "-+\n")
 
1272
            "(?:Text attachment: )?log"
 
1273
            "(?:\n-+\n|: {{{)"
 
1274
            "\d+\.\d+  \\\\u2606"
 
1275
            "(?:\n-+\n|}}}\n)")
1273
1276
 
1274
1277
 
1275
1278
class SampleTestCase(tests.TestCase):
1754
1757
        result = self._run_test('test_fail')
1755
1758
        self.assertEqual(1, len(result.failures))
1756
1759
        result_content = result.failures[0][1]
1757
 
        self.assertContainsRe(result_content, 'Text attachment: log')
 
1760
        self.assertContainsRe(result_content,
 
1761
            '(?m)^(?:Text attachment: )?log(?:$|: )')
1758
1762
        self.assertContainsRe(result_content, 'this was a failing test')
1759
1763
 
1760
1764
    def test_error_has_log(self):
1761
1765
        result = self._run_test('test_error')
1762
1766
        self.assertEqual(1, len(result.errors))
1763
1767
        result_content = result.errors[0][1]
1764
 
        self.assertContainsRe(result_content, 'Text attachment: log')
 
1768
        self.assertContainsRe(result_content,
 
1769
            '(?m)^(?:Text attachment: )?log(?:$|: )')
1765
1770
        self.assertContainsRe(result_content, 'this test errored')
1766
1771
 
1767
1772
    def test_skip_has_no_log(self):
1786
1791
        result = self._run_test('test_xfail')
1787
1792
        self.assertEqual(1, len(result.expectedFailures))
1788
1793
        result_content = result.expectedFailures[0][1]
1789
 
        self.assertNotContainsRe(result_content, 'Text attachment: log')
 
1794
        self.assertNotContainsRe(result_content,
 
1795
            '(?m)^(?:Text attachment: )?log(?:$|: )')
1790
1796
        self.assertNotContainsRe(result_content, 'test with expected failure')
1791
1797
 
1792
1798
    def test_unexpected_success_has_log(self):
2201
2207
        self.assertNotContainsRe(content, 'test with expected failure')
2202
2208
        self.assertEqual(1, len(result.expectedFailures))
2203
2209
        result_content = result.expectedFailures[0][1]
2204
 
        self.assertNotContainsRe(result_content, 'Text attachment: log')
 
2210
        self.assertNotContainsRe(result_content,
 
2211
            '(?m)^(?:Text attachment: )?log(?:$|: )')
2205
2212
        self.assertNotContainsRe(result_content, 'test with expected failure')
2206
2213
 
2207
2214
    def test_unexpected_success_has_log(self):