def process_task(self, arg_task_file): try: # get the subdirectory index my_ndx = int(PathUtils.next_subdir()) # update the user label and send iteration message to the screen if user is active # my_usr_lbl = Msg.set_label( "user", "TEST-ITERATION" ) # Msg.user( "Executing Iteration #%d of Test File: %s" % ( my_ndx + 1, arg_task_file )) # Msg.set_label( "user", my_usr_lbl ) # create subdirectory and change into it PathUtils.chdir("%05d" % my_ndx, True) # save the task template file name with path to the control item self.ctrl_item.fname = arg_task_file # write out the control file # if the write was successful then enqueue the new control file name with real path my_ctrl_file = "%s_def_frun.py" % ( PathUtils.include_trailing_path_delimiter( PathUtils.current_dir())) PathUtils.touch("%sSTARTED" % PathUtils.include_trailing_path_delimiter( PathUtils.current_dir())) my_content = self.prepare(arg_task_file) if self.write_control_file(my_ctrl_file, my_content): # my_queue_item = ProcessQueueItem( my_ctrl_file, self.ctrl_item.parent_fctrl, self.ctrl_item.fctrl_item, self.ctrl_item.group, my_content ) my_queue_item = ProcessQueueItem( my_ctrl_file, self.ctrl_item, my_content ) # self.parent_fctrl, self.ctrl_item.fctrl_item, self.ctrl_item.group) self.ctrl_item.parent_data.process_queue.enqueue(my_queue_item) except Exception as arg_ex: Msg.error_trace() Msg.err(str(arg_ex)) # reraise to prevent adding to summary instance raise finally: PathUtils.chdir("..")
def process_task_list(self): for my_task_file in self.task_list: # Msg.dbg( "Process Task File: %s" % ( my_task_file )) my_curdir = PathUtils.current_dir() try: # self.process_task_file( my_task_file ) self.process_task_file(my_task_file) except Exception as arg_ex: Msg.error_trace() Msg.err(str(arg_ex)) Msg.blank() finally: PathUtils.chdir(my_curdir)
# with UnitTest_HiStack(): pass # checks for usage requests and performs the initial validation of the command line def check_usage(self): # validate arguments if self.option_def(CmdLine.Switches[CmdLine.help], False, CmdLine.Help): # if self.get_option( ["-h","--" + CmdLine.Switches[CmdLine.help].replace("=", "" )], False ): from force_init import force_usage force_usage(UsageStr) if __name__ == "__main__": # save current working directory my_pwd = PathUtils.current_dir() try: my_module = UnitTestRun(the_force_root) Msg.info("\nForce Path: %s" % (str(the_force_root))) Msg.info("Original Directory: " + my_pwd) Msg.dbg("Processing Command Line and Loading Control File") my_module.load() Msg.dbg("Directory set to %s" % (PathUtils.current_dir())) if not PathUtils.chdir(the_force_root, False): Msg.dbg( "Directory Unchanged, using the current directory for output")