~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

Changes from review (poolie)

Show diffs side-by-side

added added

removed removed

Lines of Context:
920
920
            self.fail("%r is an instance of %s rather than %s" % (
921
921
                obj, obj.__class__, kls))
922
922
 
923
 
    def expectFailure(self, reason, test, *args, **kwargs):
 
923
    def expectFailure(self, reason, assertion, *args, **kwargs):
924
924
        """Invoke a test, expecting it to fail for the given reason.
925
925
 
 
926
        This is for assertions that ought to succeed, but currently fail.
 
927
        (The failure is *expected* but not *wanted*.)
 
928
 
926
929
        Intended to be used with a callable that raises AssertionError as the
927
 
        test.  args and kwargs are passed to the test.
 
930
        'assertion' parameter.  args and kwargs are passed to the 'assertion'.
928
931
 
929
932
        Raises KnownFailure if the test fails.  Raises AssertionError if the
930
933
        test succeeds.
934
937
                             'path/that/should/exist')
935
938
        """
936
939
        try:
937
 
            test(*args, **kwargs)
 
940
            assertion(*args, **kwargs)
938
941
        except AssertionError:
939
942
            raise KnownFailure(reason)
940
943
        else: