Пример #1
0
 def test_instance(self):
     if os.getenv("TRAVIS") == 'true':
         raise unittest.SkipTest()
     m = mizfile.MizFile(
         os.path.join(root, "BenJee/MiG-29S - Abkhaz Fulcrums.miz"))
     m.check().decompact().recompact().delete_temp_dir()
     self.assertTrue(
         os.path.exists(
             os.path.join(root,
                          "BenJee/TDCMEME/MiG-29S - Abkhaz Fulcrums.miz")))
     os.remove(
         os.path.join(root, "BenJee/TDCMEME/MiG-29S - Abkhaz Fulcrums.miz"))
     os.removedirs(os.path.join(root, "BenJee/TDCMEME"))
Пример #2
0
 def __init__(self, path_to_miz_file, temp_dir=None):
     self.logger.info("instanciation d'un nouvel object mission: {}".format(
         path_to_miz_file))
     self.mizfile = mizfile.MizFile(path_to_miz_file).check().decompact()
     self.logger.debug("miz_file checkée et decompressée dans: {}".format(
         self.mizfile.temp_dir))
     self.path_to_mission_file = os.path.join(self.mizfile.temp_dir,
                                              "mission")
     self.logger.debug("chemin complet vers le fichier mission: {}".format(
         self.path_to_mission_file))
     parser = _slpp.SLPP()
     try:
         with open(self.path_to_mission_file, mode="r",
                   encoding="UTF-8") as file:
             self.logger.debug("lecture du contenu du fichier mission")
             self.raw_text = file.read()
     except:
         Exceptions.Error(
             "Erreur fatale lors de la lecture du fichier mission",
             "Impossible de lire le fichier mission suivant: {}".format(
                 self.path_to_mission_file))
     self.logger.debug("délégation de la table de mission au parser SLPP")
     self.d = parser.decode(self.raw_text)
     self.check()
Пример #3
0
 def test_mizfile_file_does_no_exist(self):
     with self.assertRaises(Exceptions.FileDoesNotExist):
         m = mizfile.MizFile(os.path.join(root, "INVALID_CARIBOU"))
         m.check()
Пример #4
0
 def test_mizfile_check_permission_errors(self):
     if os.getenv("TRAVIS") == 'true':
         raise unittest.SkipTest()
     with self.assertRaises(Exceptions.PermissionError):
         m = mizfile.MizFile(os.path.join(root, "INVALID"))
         m.check()
Пример #5
0
 def test_mizfile_check_bad_zip_file(self):
     if os.getenv("TRAVIS") == 'true':
         raise unittest.SkipTest()
     with self.assertRaises(Exceptions.InvalidMizFile):
         m = mizfile.MizFile(os.path.join(root, "INVALID/invalid.miz"))
         m.check()