~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2005-12-01 19:27:48 UTC
  • mto: (1185.50.19 bzr-jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1532.
  • Revision ID: john@arbash-meinel.com-20051201192748-369238cd06ecf7e8
Added osutils.mkdtemp()

Show diffs side-by-side

added added

removed removed

Lines of Context:
241
241
            return
242
242
        raise AssertionError("texts not equal:\n" + 
243
243
                             self._ndiff_strings(a, b))      
 
244
        
 
245
    def assertStartsWith(self, s, prefix):
 
246
        if not s.startswith(prefix):
 
247
            raise AssertionError('string %r does not start with %r' % (s, prefix))
 
248
 
 
249
    def assertEndsWith(self, s, suffix):
 
250
        if not s.endswith(prefix):
 
251
            raise AssertionError('string %r does not end with %r' % (s, suffix))
244
252
 
245
253
    def assertContainsRe(self, haystack, needle_re):
246
254
        """Assert that a contains something matching a regular expression."""
551
559
    def failUnlessExists(self, path):
552
560
        """Fail unless path, which may be abs or relative, exists."""
553
561
        self.failUnless(osutils.lexists(path))
 
562
 
 
563
    def failIfExists(self, path):
 
564
        """Fail if path, which may be abs or relative, exists."""
 
565
        self.failIf(osutils.lexists(path))
554
566
        
555
567
    def assertFileEqual(self, content, path):
556
568
        """Fail if path does not contain 'content'."""
557
569
        self.failUnless(osutils.lexists(path))
558
570
        self.assertEqualDiff(content, open(path, 'r').read())
559
 
        
 
571
 
560
572
 
561
573
class MetaTestLog(TestCase):
562
574
    def test_logging(self):