コード例 #1
0
ファイル: ConfigFileSystemTest.py プロジェクト: thiell/shine
 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
コード例 #2
0
 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
コード例 #3
0
 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
コード例 #4
0
ファイル: ConfigFileSystemTest.py プロジェクト: thiell/shine
 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
コード例 #5
0
 def _compare(self, orig, new):
     tmpfile = makeTempFile(orig)
     origconf = FileSystem(tmpfile.name)
     newfile = makeTempFile(new)
     newconf = FileSystem(newfile.name)
     return origconf.compare(newconf)
コード例 #6
0
ファイル: ConfigFileSystemTest.py プロジェクト: thiell/shine
 def testLoadFile(self):
     """create a FileSystem from model example.lmf"""
     fs = FileSystem(filename="../conf/models/example.lmf")
     self.assertEqual(len(fs.model), 15)
コード例 #7
0
ファイル: ConfigFileSystemTest.py プロジェクト: thiell/shine
 def _compare(self, orig, new):
     tmpfile = makeTempFile(orig)
     origconf = FileSystem(tmpfile.name)
     newfile = makeTempFile(new)
     newconf = FileSystem(newfile.name)
     return origconf.compare(newconf)
コード例 #8
0
 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)
コード例 #9
0
 def create_from_model(cls, lmf, update_mode=False):
     conf = Configuration()
     conf._fs = FileSystem.create_from_model(lmf, update_mode=update_mode)
     return conf
コード例 #10
0
 def load_from_model(cls, lmf):
     conf = Configuration()
     conf._fs = FileSystem(lmf)
     return conf
コード例 #11
0
 def load_from_cache(cls, fsname):
     conf = Configuration()
     conf._fs = FileSystem.load_from_fsname(fsname)
     return conf
コード例 #12
0
 def create_from_model(cls, lmf, update_mode=False):
     conf = Configuration()
     conf._fs = FileSystem.create_from_model(lmf, update_mode=update_mode)
     return conf
コード例 #13
0
 def load_from_cache(cls, fsname):
     conf = Configuration()
     conf._fs = FileSystem.load_from_fsname(fsname)
     return conf