~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Marius Kruger
  • Date: 2007-01-11 06:14:15 UTC
  • mto: This revision was merged to the branch mainline in revision 2241.
  • Revision ID: amanic@gmail.com-20070111061415-waq22luaja5czdry
* bzrlib/tests/__init__
  - add utility assert methods: assertNone and assertNotNone
  - failUnlessExists and failIfExists give beter messages when failing

Show diffs side-by-side

added added

removed removed

Lines of Context:
665
665
        if not (left is right):
666
666
            raise AssertionError("%r is not %r." % (left, right))
667
667
 
 
668
    def assertNone(self, obj, msg):
 
669
        """Fail if obj is not None"""
 
670
        if (obj is not None):
 
671
            raise AssertionError(msg)
 
672
 
 
673
    def assertNotNone(self, obj, msg):
 
674
        """Fail if obj is None"""
 
675
        if (obj is None):
 
676
            raise AssertionError(msg)
 
677
 
668
678
    def assertTransportMode(self, transport, path, mode):
669
679
        """Fail if a path does not have mode mode.
670
680
        
1264
1274
 
1265
1275
    def failUnlessExists(self, path):
1266
1276
        """Fail unless path, which may be abs or relative, exists."""
1267
 
        self.failUnless(osutils.lexists(path))
 
1277
        self.failUnless(osutils.lexists(path),path+" does not exist")
1268
1278
 
1269
1279
    def failIfExists(self, path):
1270
1280
        """Fail if path, which may be abs or relative, exists."""
1271
 
        self.failIf(osutils.lexists(path))
 
1281
        self.failIf(osutils.lexists(path),path+" exists")
1272
1282
        
1273
1283
    def get_transport(self):
1274
1284
        """Return a writeable transport for the test scratch space"""