def generate_script(self, files):
        self.__prepare_output_folder()

        mock_files = {}
        output_file_name = os.path.join(self.work_dir, self.__MOCK_SCRIPT_NAME)

        # generate file names and content
        for k, v in files.items():
            mock_files.update(self.__create_mock_file(k, v, write_files=False))

        # add files to script
        template = read_template('mock_script_template.py')
        output = template.render(mocks=pickle.dumps(mock_files))
        write_all_text(output_file_name, output)
    def generate_script(self, files):
        self.__prepare_output_folder()

        mock_files = {}
        output_file_name = os.path.join(self.work_dir, self.__MOCK_SCRIPT_NAME)

        # generate file names and content
        for k, v in files.items():
            mock_files.update(self.__create_mock_file(k, v, write_files=False))

        # add files to script
        template = read_template('mock_script_template.py')
        output = template.render(mocks=pickle.dumps(mock_files))
        write_all_text(output_file_name, output)
    def __generate_executable(self, command, stub_info):
        # generate new executable
        exec_file = os.path.join(self.output_folder, '%s' % command)

        # create stub info dict
        info_dict = stub_info.__dict__

        # pop nodeType for less dependency
        info_dict.pop('nodeType')

        # generate template
        output = self.template.render(stub_info=pickle.dumps(info_dict))

        # write output
        write_all_text(exec_file, output)
    def __generate_executable(self, command, stub_info):
        # generate new executable
        exec_file = os.path.join(self.output_folder, '%s' % command)

        # create stub info dict
        info_dict = stub_info.__dict__

        # pop nodeType for less dependency
        info_dict.pop('nodeType')

        # generate template
        output = self.template.render(stub_info=pickle.dumps(info_dict))

        # write output
        write_all_text(exec_file, output)