def testFileClass(self): for filename in self.testfiles: filename = os.path.join(tmpdir, self.testdir, filename) expected = TestFile(filename) if filename.endswith(os.path.sep): filename = filename[:-1] actual = sqlitecache.File(filename) self.assertFilesEqual(expected, actual)
def addPathToFileObjects(self, path, root): path = path.rstrip(os.path.sep) ref, base = os.path.split(path) if ref: if not ref in self.fileobjects: self.addPathToFileObjects(ref, root) parent = self.fileobjects[ref] else: parent = root fob = sqlitecache.File(base, parent=parent) self.id_fileobj(fob) self.fileobjects[path] = fob
def setupFileObjects(self): testpath = os.path.abspath(self.testdir) root = sqlitecache.File(testpath) self.fileobjects[''] = root for path in self.testfiles: self.addPathToFileObjects(path, root)