diff options
Diffstat (limited to 'libbe')
-rw-r--r-- | libbe/storage/base.py | 28 | ||||
-rw-r--r-- | libbe/storage/vcs/base.py | 3 |
2 files changed, 17 insertions, 14 deletions
diff --git a/libbe/storage/base.py b/libbe/storage/base.py index d16c30b..ffde475 100644 --- a/libbe/storage/base.py +++ b/libbe/storage/base.py @@ -501,7 +501,7 @@ if TESTING == True: ids = [] for i in range(10): ids.append(str(i)) - self.s.add(ids[-1], directory=False) + self.s.add(ids[-1], directory=(i % 2 == 0)) s = sorted(self.s.children()) self.failUnless(s == ids, '\n %s\n !=\n %s' % (s, ids)) @@ -513,7 +513,7 @@ if TESTING == True: ids = [] for i in range(10): ids.append(str(i)) - self.s.add(ids[-1], 'parent', directory=True) + self.s.add(ids[-1], 'parent', directory=(i % 2 == 0)) s = sorted(self.s.children('parent')) self.failUnless(s == ids, '\n %s\n !=\n %s' % (s, ids)) s = self.s.children() @@ -527,7 +527,7 @@ if TESTING == True: ids = [] for i in range(10): ids.append('parent/%s' % str(i)) - self.s.add(ids[-1], 'parent', directory=True) + self.s.add(ids[-1], 'parent', directory=(i % 2 == 0)) s = sorted(self.s.children('parent')) self.failUnless(s == ids, '\n %s\n !=\n %s' % (s, ids)) @@ -560,7 +560,7 @@ if TESTING == True: ids = [] for i in range(10): ids.append(str(i)) - self.s.add(ids[-1], directory=True) + self.s.add(ids[-1], directory=(i % 2 == 0)) for i in range(10): self.s.remove(ids.pop()) s = sorted(self.s.children()) @@ -574,13 +574,14 @@ if TESTING == True: ids = [] for i in range(10): ids.append(str(i)) - self.s.add(ids[-1], 'parent', directory=False) + self.s.add(ids[-1], 'parent', directory=False)#(i % 2 == 0)) for i in range(10): self.s.remove(ids.pop()) s = sorted(self.s.children('parent')) self.failUnless(s == ids, '\n %s\n !=\n %s' % (s, ids)) - s = self.s.children() - self.failUnless(s == ['parent'], s) + if len(s) > 0: + s = self.s.children() + self.failUnless(s == ['parent'], s) def test_remove_directory_not_empty(self): """ @@ -590,7 +591,7 @@ if TESTING == True: ids = [] for i in range(10): ids.append(str(i)) - self.s.add(ids[-1], 'parent', directory=True) + self.s.add(ids[-1], 'parent', directory=(i % 2 == 0)) self.s.remove(ids.pop()) # empty directory removal succeeds try: self.s.remove('parent') # empty directory removal succeeds @@ -610,7 +611,7 @@ if TESTING == True: ids.append(str(i)) self.s.add(ids[-1], 'parent', directory=True) for j in range(10): # add some grandkids - self.s.add(str(20*(i+1)+j), ids[-1], directory=False) + self.s.add(str(20*(i+1)+j), ids[-1], directory=(i%2 == 0)) self.s.recursive_remove('parent') s = sorted(self.s.children()) self.failUnless(s == [], s) @@ -726,7 +727,7 @@ if TESTING == True: ids = [] for i in range(10): ids.append(str(i)) - self.s.add(ids[-1], 'parent', directory=False) + self.s.add(ids[-1], 'parent', directory=(i % 2 == 0)) self.s.disconnect() self.s.connect() s = sorted(self.s.children('parent')) @@ -842,7 +843,7 @@ if TESTING == True: children = [] for i in range(10): new_child = str(i) - self.s.add(new_child, 'parent', directory=False) + self.s.add(new_child, 'parent', directory=(i % 2 == 0)) self.s.set(new_child, self.val) revs.append(self.s.commit('%s: %d' % (self.commit_msg, i), self.commit_body)) @@ -861,7 +862,7 @@ if TESTING == True: c for c in ( ob for ob in globals().values() if isinstance(ob, type)) if issubclass(c, StorageTestCase) \ - and not issubclass(c, VersionedStorageTestCase)] + and c.Class == Storage] for base_class in storage_testcase_classes: testcase_class_name = storage_class.__name__ + base_class.__name__ @@ -877,7 +878,8 @@ if TESTING == True: storage_testcase_classes = [ c for c in ( ob for ob in globals().values() if isinstance(ob, type)) - if issubclass(c, StorageTestCase)] + if issubclass(c, StorageTestCase) \ + and c.Class == Storage] for base_class in storage_testcase_classes: testcase_class_name = storage_class.__name__ + base_class.__name__ diff --git a/libbe/storage/vcs/base.py b/libbe/storage/vcs/base.py index 533ef4c..6ece16d 100644 --- a/libbe/storage/vcs/base.py +++ b/libbe/storage/vcs/base.py @@ -1085,7 +1085,8 @@ if libbe.TESTING == True: vcs_testcase_classes = [ c for c in ( ob for ob in globals().values() if isinstance(ob, type)) - if issubclass(c, VCSTestCase)] + if issubclass(c, VCSTestCase) \ + and c.Class == VCS] for base_class in vcs_testcase_classes: testcase_class_name = vcs_class.__name__ + base_class.__name__ |