~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-04-16 01:09:56 UTC
  • mfrom: (5784.1.4 760435-less-fail)
  • Revision ID: pqm@pqm.ubuntu.com-20110416010956-5wrpm136qq2hz5f3
(mbp) rename and deprecate failUnlessExists and failIfExists (Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1444
1444
 
1445
1445
    def assertFileEqual(self, content, path):
1446
1446
        """Fail if path does not contain 'content'."""
1447
 
        self.failUnlessExists(path)
 
1447
        self.assertPathExists(path)
1448
1448
        f = file(path, 'rb')
1449
1449
        try:
1450
1450
            s = f.read()
1460
1460
        else:
1461
1461
            self.assertEqual(expected_docstring, obj.__doc__)
1462
1462
 
 
1463
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4)))
1463
1464
    def failUnlessExists(self, path):
 
1465
        return self.assertPathExists(path)
 
1466
 
 
1467
    def assertPathExists(self, path):
1464
1468
        """Fail unless path or paths, which may be abs or relative, exist."""
1465
1469
        if not isinstance(path, basestring):
1466
1470
            for p in path:
1467
 
                self.failUnlessExists(p)
 
1471
                self.assertPathExists(p)
1468
1472
        else:
1469
1473
            self.assertTrue(osutils.lexists(path),
1470
1474
                path + " does not exist")
1471
1475
 
 
1476
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4)))
1472
1477
    def failIfExists(self, path):
 
1478
        return self.assertPathDoesNotExist(path)
 
1479
 
 
1480
    def assertPathDoesNotExist(self, path):
1473
1481
        """Fail if path or paths, which may be abs or relative, exist."""
1474
1482
        if not isinstance(path, basestring):
1475
1483
            for p in path:
1476
 
                self.failIfExists(p)
 
1484
                self.assertPathDoesNotExist(p)
1477
1485
        else:
1478
1486
            self.assertFalse(osutils.lexists(path),
1479
1487
                path + " exists")