def write_submit(tgt_dir, sub_tpl_base, sub_tpl_line, step, overwrite=False): """ Uses the given templates and step number to write a submit script to the given target file location. :param sub_tpl_base: The base template. :param sub_tpl_line: The line template. :param step: The step number. :param tgt_dir: The target directory. :param overwrite: Whether to allow overwrites. """ sub_file = os.path.join(tgt_dir, STEP_SUBMIT_FNAME.format(step)) if allow_write(sub_file, overwrite): wham_fill = fill_submit_wham(sub_tpl_base, sub_tpl_line, step, use_part=False) str_to_file(wham_fill, sub_file)
def testFillSubmit(self): wham_fill = fill_submit_wham(self.base_tpl, self.line_tpl, 5) self.assertEqual(file_to_str(SUBMIT_05_PATH), wham_fill)