/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

Merge bzr.dev 5848, bringing the code up to date.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1267
1267
                         'st_mtime did not match')
1268
1268
        self.assertEqual(expected.st_ctime, actual.st_ctime,
1269
1269
                         'st_ctime did not match')
1270
 
        if sys.platform != 'win32':
 
1270
        if sys.platform == 'win32':
1271
1271
            # On Win32 both 'dev' and 'ino' cannot be trusted. In python2.4 it
1272
1272
            # is 'dev' that varies, in python 2.5 (6?) it is st_ino that is
1273
 
            # odd. Regardless we shouldn't actually try to assert anything
1274
 
            # about their values
 
1273
            # odd. We just force it to always be 0 to avoid any problems.
 
1274
            self.assertEqual(0, expected.st_dev)
 
1275
            self.assertEqual(0, actual.st_dev)
 
1276
            self.assertEqual(0, expected.st_ino)
 
1277
            self.assertEqual(0, actual.st_ino)
 
1278
        else:
1275
1279
            self.assertEqual(expected.st_dev, actual.st_dev,
1276
1280
                             'st_dev did not match')
1277
1281
            self.assertEqual(expected.st_ino, actual.st_ino,
1440
1444
 
1441
1445
    def assertFileEqual(self, content, path):
1442
1446
        """Fail if path does not contain 'content'."""
1443
 
        self.failUnlessExists(path)
 
1447
        self.assertPathExists(path)
1444
1448
        f = file(path, 'rb')
1445
1449
        try:
1446
1450
            s = f.read()
1456
1460
        else:
1457
1461
            self.assertEqual(expected_docstring, obj.__doc__)
1458
1462
 
 
1463
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4)))
1459
1464
    def failUnlessExists(self, path):
 
1465
        return self.assertPathExists(path)
 
1466
 
 
1467
    def assertPathExists(self, path):
1460
1468
        """Fail unless path or paths, which may be abs or relative, exist."""
1461
1469
        if not isinstance(path, basestring):
1462
1470
            for p in path:
1463
 
                self.failUnlessExists(p)
 
1471
                self.assertPathExists(p)
1464
1472
        else:
1465
 
            self.failUnless(osutils.lexists(path),path+" does not exist")
 
1473
            self.assertTrue(osutils.lexists(path),
 
1474
                path + " does not exist")
1466
1475
 
 
1476
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((2, 4)))
1467
1477
    def failIfExists(self, path):
 
1478
        return self.assertPathDoesNotExist(path)
 
1479
 
 
1480
    def assertPathDoesNotExist(self, path):
1468
1481
        """Fail if path or paths, which may be abs or relative, exist."""
1469
1482
        if not isinstance(path, basestring):
1470
1483
            for p in path:
1471
 
                self.failIfExists(p)
 
1484
                self.assertPathDoesNotExist(p)
1472
1485
        else:
1473
 
            self.failIf(osutils.lexists(path),path+" exists")
 
1486
            self.assertFalse(osutils.lexists(path),
 
1487
                path + " exists")
1474
1488
 
1475
1489
    def _capture_deprecation_warnings(self, a_callable, *args, **kwargs):
1476
1490
        """A helper for callDeprecated and applyDeprecated.
2111
2125
                      % (process_args, retcode, process.returncode))
2112
2126
        return [out, err]
2113
2127
 
2114
 
    def check_inventory_shape(self, inv, shape):
2115
 
        """Compare an inventory to a list of expected names.
 
2128
    def check_tree_shape(self, tree, shape):
 
2129
        """Compare a tree to a list of expected names.
2116
2130
 
2117
2131
        Fail if they are not precisely equal.
2118
2132
        """
2119
2133
        extras = []
2120
2134
        shape = list(shape)             # copy
2121
 
        for path, ie in inv.entries():
 
2135
        for path, ie in tree.iter_entries_by_dir():
2122
2136
            name = path.replace('\\', '/')
2123
2137
            if ie.kind == 'directory':
2124
2138
                name = name + '/'
2125
 
            if name in shape:
 
2139
            if name == "/":
 
2140
                pass # ignore root entry
 
2141
            elif name in shape:
2126
2142
                shape.remove(name)
2127
2143
            else:
2128
2144
                extras.append(name)
3760
3776
        'bzrlib.tests.test_decorators',
3761
3777
        'bzrlib.tests.test_delta',
3762
3778
        'bzrlib.tests.test_debug',
3763
 
        'bzrlib.tests.test_deprecated_graph',
3764
3779
        'bzrlib.tests.test_diff',
3765
3780
        'bzrlib.tests.test_directory_service',
3766
3781
        'bzrlib.tests.test_dirstate',