/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/__init__.py

Update docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
924
924
        """Invoke a test, expecting it to fail for the given reason.
925
925
 
926
926
        This is for assertions that ought to succeed, but currently fail.
927
 
        (The failure is *expected* but not *wanted*.)
 
927
        (The failure is *expected* but not *wanted*.)  Please be very precise
 
928
        about the failure you're expecting.  If a new bug is introduced,
 
929
        AssertionError should be raised, not KnownFailure.
 
930
 
 
931
        Frequently, expectFailure should be followed by an opposite assertion.
 
932
        See example below.
928
933
 
929
934
        Intended to be used with a callable that raises AssertionError as the
930
935
        'assertion' parameter.  args and kwargs are passed to the 'assertion'.
933
938
        test succeeds.
934
939
 
935
940
        example usage::
936
 
          self.expectFailure('File creation is broken', self.failUnlessExists,
937
 
                             'path/that/should/exist')
 
941
 
 
942
          self.expectFailure('Math is broken', self.assertNotEqual, 54,
 
943
                             dynamic_val)
 
944
          self.assertEqual(42, dynamic_val)
 
945
 
 
946
          This means that a dynamic_val of 54 will cause the test to raise
 
947
          a KnownFailure.  Once math is fixed and the expectFailure is removed,
 
948
          only a dynamic_val of 42 will allow the test to pass.  Anything other
 
949
          than 54 or 42 will cause an AssertionError.
938
950
        """
939
951
        try:
940
952
            assertion(*args, **kwargs)