~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

Implement TestCase.expectFailure

Show diffs side-by-side

added added

removed removed

Lines of Context:
1429
1429
        # runners.
1430
1430
        self.assertIsInstance(KnownFailure(""), AssertionError)
1431
1431
 
 
1432
    def test_expect_failure(self):
 
1433
        try:
 
1434
            self.expectFailure("Doomed to failure", self.assertTrue, False)
 
1435
        except KnownFailure, e:
 
1436
            self.assertEqual('Doomed to failure', e.args[0])
 
1437
        try:
 
1438
            self.expectFailure("Doomed to failure", self.assertTrue, True)
 
1439
        except AssertionError, e:
 
1440
            self.assertEqual('Unexpected success.  Should have failed:'
 
1441
                             ' Doomed to failure', e.args[0])
 
1442
        else:
 
1443
            self.fail('Assertion not raised')
 
1444
 
1432
1445
 
1433
1446
class TestFeature(TestCase):
1434
1447