def make_fs_with_backend(self, backend, text): """ Create a FileSystem instance from text with a specific backend instance. """ self._testfile = makeTempFile(text) fs = FileSystem(self._testfile.name) fs.backend = backend fs.setup_target_devices() return fs
def makeConfFileSystem(self, text): """ Create a temporary file instance and returns a FileSystem with it. """ self._testfile = makeTempFile(text) fsconf = FileSystem.create_from_model(self._testfile.name) return fsconf
def _compare(self, orig, new): tmpfile = makeTempFile(orig) origconf = FileSystem(tmpfile.name) newfile = makeTempFile(new) newconf = FileSystem(newfile.name) return origconf.compare(newconf)
def testLoadFile(self): """create a FileSystem from model example.lmf""" fs = FileSystem(filename="../conf/models/example.lmf") self.assertEqual(len(fs.model), 15)
def _compare(self, orig, new): tmpfile = makeTempFile(textwrap.dedent(orig)) origconf = FileSystem(tmpfile.name) newfile = makeTempFile(textwrap.dedent(new)) newconf = FileSystem(newfile.name) return origconf.compare(newconf)
def create_from_model(cls, lmf, update_mode=False): conf = Configuration() conf._fs = FileSystem.create_from_model(lmf, update_mode=update_mode) return conf
def load_from_model(cls, lmf): conf = Configuration() conf._fs = FileSystem(lmf) return conf
def load_from_cache(cls, fsname): conf = Configuration() conf._fs = FileSystem.load_from_fsname(fsname) return conf