def check_scripts(self, type_name):
     """
     The function checks whether script exists in content directory
     If check_script exists then the script checks whether it is executable
     """
     if not os.path.exists(self.full_path_name):
         print ("ERROR: ", self.full_path_name, "Script name does not exists")
         print ("List of directory (", self.dir_name, ") is:")
         for file_name in os.listdir(self.dir_name):
             print (file_name)
         raise MissingFileInContentError
     if type_name != 'solution':
         FileHelper.check_executable(self.full_path_name)
예제 #2
0
 def check_scripts(self, type_name):
     """
     The function checks whether script exists in content directory
     If check_script exists then the script checks whether it is executable
     """
     if not os.path.exists(self.full_path_name):
         print("ERROR: ", self.full_path_name,
               "Script name does not exists")
         print("List of directory (", self.dir_name, ") is:")
         for file_name in os.listdir(self.dir_name):
             print(file_name)
         raise MissingFileInContentError
     if type_name != 'solution':
         FileHelper.check_executable(self.full_path_name)
    def check_scripts(self, type_name):
        """
        The function checks whether script exists in content directory
        If check_script exists then the script checks whether it is executable

        @param {str} type_name - name of the script e.g. solution
            or check_script
        @throws {MissingFileInContentError}
        """
        if type_name == 'check_script':
            if not os.path.isfile(self.check_script_path):
                raise MissingFileInContentError(file=self.check_script_path,
                                                dir=self.dir_name)
            FileHelper.check_executable(self.check_script_path)
        else:
            if not os.path.isfile(self.solution_txt_path):
                raise MissingFileInContentError(file=self.solution_txt_path,
                                                dir=self.dir_name)
예제 #4
0
    def check_scripts(self, type_name):
        """
        The function checks whether script exists in content directory
        If check_script exists then the script checks whether it is executable

        @param {str} type_name - name of the script e.g. solution
            or check_script
        @throws {MissingFileInContentError}
        """
        if type_name == 'check_script':
            if not os.path.isfile(self.check_script_path):
                raise MissingFileInContentError(file=self.check_script_path,
                                                dir=self.dir_name)
            FileHelper.check_executable(self.check_script_path)
        else:
            if not os.path.isfile(self.solution_txt_path):
                raise MissingFileInContentError(file=self.solution_txt_path,
                                                dir=self.dir_name)