def test_check_valid_path(self): self.assertIsNone(PathManager.check_valid_path(None)) self.assertRaises(FileNotFoundError, PathManager.check_valid_path, ("/coucou/toto")) tempdir = os.path.join(tempfile.gettempdir(), 'test_bak') self.assertEqual(PathManager.check_valid_path(tempdir), tempdir)
def test_run_rerun_runtime(self): # Slow run cmd_line = [ "python", "-D", self.__db_url, "-w", self.__example_def_file1, "-v" ] time_unix_ms, time_human = get_current_time() start = time_unix_ms with self.assertRaises(SystemExit): WopMars().run(cmd_line) time_unix_ms, time_human = get_current_time() end = time_unix_ms runtime1 = end - start # Fast run run2<run1 time_unix_ms, time_human = get_current_time() start = time_unix_ms with self.assertRaises(SystemExit): WopMars().run(cmd_line) time_unix_ms, time_human = get_current_time() end = time_unix_ms runtime2 = end - start self.assertGreater(runtime1 * 1.5, runtime2) # Middle run: run3>run2 PathManager.unlink("outdir/output_file1.txt") time_unix_ms, time_human = get_current_time() start = time_unix_ms with self.assertRaises(SystemExit): WopMars().run(cmd_line) time_unix_ms, time_human = get_current_time() end = time_unix_ms runtime3 = end - start self.assertLess(runtime2, runtime3)
def test_dry_drun_skipping_all_but_one(self): cmd_line = [ "python", "-D", self.__db_url, "-w", self.__example_def_file1, "-v" ] with self.assertRaises(SystemExit): WopMars().run(cmd_line) PathManager.unlink("outdir/output_file7.txt") with self.assertRaises(SystemExit): WopMars().run(cmd_line + ["-n"])
def setUp(self): self.test_path = PathManager.get_test_path() # Get tests path OptionManager.initial_test_setup() # Set tests arguments self.db_url = OptionManager.instance()["--database"] self.db = self.db_url[10:] self.example_dir_path = os.path.join(PathManager.get_package_path(), "data/example") self.wopfile = os.path.join(self.example_dir_path, "Wopfile.yml") self.working_directory = os.path.join(PathManager.get_package_path(), "data/example")
def tearDown(self): # pass # pip.main(['uninstall', 'wopexamplecar', '-y']) # working in travis subprocess.run( [sys.executable, '-m', 'pip', 'uninstall', 'example', '-y']) shutil.rmtree(os.path.join(self.working_directory, "build"), ignore_errors=True) shutil.rmtree(os.path.join(self.working_directory, "wopexamplecar.egg-info"), ignore_errors=True) PathManager.unlink(self.db) OptionManager._drop() SQLManager._drop()
def initial_test_setup(): OptionManager.instance()["-v"] = 1 OptionManager.instance()["--dot"] = None OptionManager.instance()["--since"] = None OptionManager.instance()["--until"] = None OptionManager.instance()["--forceall"] = None OptionManager.instance()["--dry-run"] = None OptionManager.instance()["--touch"] = None OptionManager.instance()["tool"] = None test_outdir_path = os.path.join(PathManager.get_test_path(), "outdir") # shutil.rmtree(test_outdir_path, ignore_errors=True) pathlib.Path(test_outdir_path).mkdir(parents=True, exist_ok=True) OptionManager.instance()["--database"] = "sqlite:///{}".format( os.path.join(test_outdir_path, 'db.sqlite')) OptionManager.instance()["--directory"] = PathManager.get_test_path() OptionManager.instance()["--cleanup-metadata"] = False os.chdir(OptionManager.instance()["--directory"])
def setUp(self): OptionManager.initial_test_setup() # Set tests arguments SQLManager.instance().create_all() # Create database with tables self.test_path = PathManager.get_test_path() self.__s_path_to_example_definition_file_finishing = os.path.join( self.test_path, "resource/wopfile/example_def_file1.yml") self.__s_path_to_example_definition_file_that_end_with_error = os.path.join( self.test_path, "resource/wopfile/example_def_file5_never_ready.yml") self.__workflow_manager = WorkflowManager()
def test_run_skipping_steps_time_check(self): cmd_line = [ "python", "-D", self.__db_url, "-w", self.__example_def_file2_only_files, "-v" ] time_unix_ms, time_human = get_current_time() start = time_unix_ms with self.assertRaises(SystemExit): WopMars().run(cmd_line) time_unix_ms, time_human = get_current_time() end = time_unix_ms runtime1 = end - start time_unix_ms, time_human = get_current_time() start = time_unix_ms with self.assertRaises(SystemExit): WopMars().run(cmd_line) time_unix_ms, time_human = get_current_time() end = time_unix_ms runtime2 = end - start self.assertGreater(runtime1 * 1.5, runtime2) # pathlib.Path('outdir/output_file1.txt').unlink() PathManager.unlink("outdir/output_file1.txt")
def setUp(self): OptionManager.initial_test_setup() # Set tests arguments SQLManager.instance().create_all() # Create database with tables session = SQLManager.instance().get_session() session.get_or_create(TypeInputOrOutput, defaults={"is_input": True}, is_input=True) session.get_or_create(TypeInputOrOutput, defaults={"is_input": False}, is_input=False) session.commit() self.__test_path = PathManager.get_test_path() # self.__test_path = PathManager.get_package_path() self.__parser = Parser()
def setUp(self): OptionManager.initial_test_setup() # Set tests arguments SQLManager.instance().create_all() # Create database with tables session = SQLManager.instance().get_session() session.get_or_create(TypeInputOrOutput, defaults={"is_input": True}, is_input=True) session.get_or_create(TypeInputOrOutput, defaults={"is_input": False}, is_input=False) session.commit() self.__session = SQLManager.instance().get_session() self.__reader = Reader() self.__testdir_path = PathManager.get_test_path() # The good -------------------------------: self.__example_def_file1_path = os.path.join(self.__testdir_path, "resource/wopfile/example_def_file1.yml") self.__example_def_file3_path = os.path.join(self.__testdir_path, "resource/wopfile/example_def_file3.yml") # The ugly (malformed file) --------------------: self.__s_example_definition_file_duplicate_rule = os.path.join(self.__testdir_path, "resource/wopfile/example_def_file_duplicate_rule.yml") self.__list_f_to_exception_init = [ os.path.join(self.__testdir_path, s_path) for s_path in [ "resource/wopfile/example_def_file_wrong_yaml.yml", "resource/wopfile/example_def_file_duplicate_rule.yml", "resource/wopfile/example_def_file_wrong_grammar.yml", "resource/wopfile/example_def_file_wrong_grammar2.yml", "resource/wopfile/example_def_file_wrong_grammar3.yml", "resource/wopfile/example_def_file_wrong_grammar4.yml" ] ] # The bad (invalid file) ----------------------: self.__list_s_to_exception_read = [ os.path.join(self.__testdir_path, s_path) for s_path in [ "resource/wopfile/example_def_file1.yml", "resource/wopfile/example_def_file_wrong_content2.yml", "resource/wopfile/example_def_file_wrong_content3.yml", "resource/wopfile/example_def_file_wrong_content4.yml", "resource/wopfile/example_def_file_wrong_content5.yml", "resource/wopfile/example_def_file_wrong_class_name.yml", "resource/wopfile/example_def_file_wrong_rule.yml", ] ]
def setUp(self): self.test_path = PathManager.get_test_path() # Get tests path OptionManager.initial_test_setup() # Set tests arguments self.__db_url = OptionManager.instance()["--database"] self.__example_def_file1 = os.path.join( self.test_path, "resource/wopfile/example_def_file1.yml") self.__example_def_file1_only_database = \ os.path.join(self.test_path, "resource/wopfile/example_def_file1_only_database.yml") self.__example_def_file2_only_files = os.path.join( self.test_path, "resource/wopfile/example_def_file2_only_files.yml") self.__example_def_file4 = os.path.join( self.test_path, "resource/wopfile/example_def_file4.yml") self.__example_def_file5_never_ready = os.path.join( self.test_path, "resource/wopfile/example_def_file5_never_ready.yml") self.__example_def_file_input_not_ready = os.path.join( self.test_path, "resource/wopfile/example_def_file_input_not_ready.yml")
def setUp(self): self.test_path = PathManager.get_test_path() OptionManager.initial_test_setup() # Set tests arguments SQLManager.instance().create_all() # Create database with tables self.__local_session = SQLManager.instance().get_session() try: for i in range(10): self.__local_session.add(FooBase(name="testIODB " + str(i))) self.__local_session.commit() except Exception as e: self.__local_session.rollback() self.__local_session.close() raise e self.__io_base_existing = TableInputOutputInformation(model_py_path="FooBase", table_key="FooBase", table_name="FooBase") self.__io_base_existing.set_table(FooBase) self.__io_base_existing2 = TableInputOutputInformation(model_py_path="FooBase", table_key="FooBase", table_name="FooBase") self.__io_base_existing2.set_table(FooBase) self.__io_base_existing3 = TableInputOutputInformation(model_py_path="FooBase2", table_key="FooBase2", table_name="FooBase2") self.__io_base_existing3.set_table(FooBase2)
def setUp(self): self.test_path = PathManager.get_test_path() # Get tests path OptionManager.initial_test_setup() # Set tests arguments s_path_to_example_existing_file = os.path.join( self.test_path, "resource/input_files/example_existing_file.txt") s_path_to_example_existing_file2 = os.path.join( self.test_path, "resource/input_files/example_existing_file2.txt") s_path_to_example_not_existing_file = os.path.join( self.test_path, "resource/input_files/example_not_existing_file.txt") self.__io_file_existing = FileInputOutputInformation( file_key="existing_file", path=s_path_to_example_existing_file) self.__io_file_existing2 = FileInputOutputInformation( file_key="existing_file", path=s_path_to_example_existing_file) self.__io_file_existing3 = FileInputOutputInformation( file_key="existing_file2", path=s_path_to_example_existing_file) self.__io_file_existing4 = FileInputOutputInformation( file_key="existing_file", path=s_path_to_example_existing_file2) self.__io_file_not_existing = FileInputOutputInformation( file_key="not_existing_file", path=s_path_to_example_not_existing_file)
def run(argv): """ Entry-point of the program """ # if the command line is malformed, docopt interrupt the software. try: if argv[1:] == []: # If not arguments, run the help argv.append('-h') OptionManager.instance().update(docopt(__doc__, argv=argv[1:])) except DocoptExit as SE: print("Bad argument in the command line: \n\t" + " ".join(argv) + "\n" + str(SE)) sys.exit(2) try: schema_option = Schema({ '--wopfile': Or("Wopfile.yml", str), '--database': Use(PathManager.check_database_valid_url), '-v': Or(0, And(int, lambda n: 1 <= n <= 2)), '--dot': Or( None, And(Use(PathManager.check_valid_path), Use(PathManager.check_pygraphviz))), "--log": Use(PathManager.check_valid_path), # '--printtools': Use(bool), "--since": Or(None, str), "--until": Or(None, str), "--forceall": Use(bool), "--dry-run": Use(bool), "--touch": Use(bool), "--directory": Use(lambda path: pathlib.Path(path).mkdir(parents=True, exist_ok=True)), "--input": Use(DictUtils.str_to_dict), "--output": Use(DictUtils.str_to_dict), "--params": Use(DictUtils.str_to_dict), "TOOLWRAPPER": Or(None, Use(PathManager.is_in_python_path)), "tool": Use(bool), "example": Use(bool), "--version": Use(bool), "--cleanup-metadata": Use(bool), }) # The option values are validated using schema library OptionManager.instance().validate(schema_option) os.chdir(OptionManager.instance()["--directory"]) except SchemaError as schema_msg: Logger.instance().debug("\nCommand line Args:" + str(OptionManager.instance())) # regex for the different possible error messages. match_open_def = re.match(r"^open\('(.[^\)]+)'\)", str(schema_msg)) match_dot_def = re.match(r"^check_valid_path\(('.[^\)]+')\)", str(schema_msg)) match_wrong_key = re.match(r"^Wrong keys ('.[^\)]+')", str(schema_msg)) match_pygraphviz = re.match(r".*dot.*", str(schema_msg)) print(match_pygraphviz) # Check the different regex.. if match_open_def: Logger.instance().error("The file " + match_open_def.group(1) + " cannot be opened. It may not exist.") elif match_dot_def: Logger.instance().error("The path " + match_dot_def.group(1) + " is not valid.") elif match_wrong_key: # Normally never reach Logger.instance().error("The option key " + match_wrong_key.group(1) + " is not known.") elif match_pygraphviz: Logger.instance().error( "The dot file path is not valid or the pygraphviz module is not installed. In the second case, install wopmars with pygraphviz: pip install wopmars[pygraphviz]" ) else: # Normally never reach Logger.instance().error( "An unknown error has occured. Message: " + str(schema_msg)) sys.exit(2) Logger.instance().debug("\nCommand line Args:" + str(OptionManager.instance())) ############################################################################################ # # Print version to stdout and exists # ############################################################################################ if OptionManager.instance()["--version"]: print("wopmars {}".format(__version__), file=sys.stdout) sys.exit(0) ############################################################################################ # # Recursively writes quickstart example and exists # ############################################################################################ if OptionManager.instance()["example"]: # ExampleBuilder().build() source_path = os.path.join(PathManager.get_package_path(), "data/example") destination_path = os.path.join("example") shutil.rmtree(destination_path, ignore_errors=True) shutil.copytree(source_path, destination_path) sys.exit(0) ############################################################################################ # # Initiates new WorkflowManager instance # ############################################################################################ workflow_manager = WorkflowManager() ############################################################################################ # # Cleans up non fully terminated executions # ############################################################################################ SQLManager.instance().clean_up_unexecuted_tool_wrappers() ############################################################################################ # # --cleanup-metadata (clear history and exit) # ############################################################################################ if OptionManager.instance()["--cleanup-metadata"]: Logger.instance().info("Deleting Wopmars history...") # Check if sqlite db path exists if pathlib.Path(SQLManager.instance(). d_database_config['db_database']).is_file(): SQLManager.instance().clear_wopmars_history() if OptionManager.instance()["--cleanup-metadata"]: sys.exit(0) try: workflow_manager.run() except WopMarsException as WE: Logger.instance().error(str(WE)) try: timestamp_epoch_millis, timestamp_human = get_current_time() Logger.instance().error( "The workflow has encountered an error at: {}".format( timestamp_human)) workflow_manager.set_finishing_informations( timestamp_human, "ERROR") except AttributeError: SQLManager.instance().get_session().rollback() Logger.instance().error( "The execution has not even begun. No informations will be stored in the database." ) except Exception as e: Logger.instance().error( "An error occurred during the rollback of the changement of the database which can be now unstable:" + str(e)) sys.exit(1) except Exception as e: Logger.instance().error("An unknown error has occurred:\n" + str(e)) sys.exit(1)
def setUpClass(cls): shutil.rmtree(os.path.join(PathManager.get_test_path(), 'outdir'), ignore_errors=True)
def setUp(self): self.test_path = PathManager.get_test_path() OptionManager.initial_test_setup() # Set tests arguments SQLManager.instance().create_all() # Create database with tables set_tw_to_add = set() self.__session = SQLManager.instance().get_session() self.input_entry = TypeInputOrOutput(is_input=True) self.output_entry = TypeInputOrOutput(is_input=False) # Toolwrappers for __eq__ test_bak opt1 = Option(name="param1", value="1") f1 = FileInputOutputInformation(file_key="input1", path="file1.txt") f1.relation_file_or_tableioinfo_to_typeio = self.input_entry f2 = FileInputOutputInformation(file_key="output1", path="file2.txt") f2.relation_file_or_tableioinfo_to_typeio = self.output_entry self.__toolwrapper1 = ToolWrapper(rule_name="rule1") self.__toolwrapper1.relation_toolwrapper_to_fileioinfo.extend([f1, f2]) self.__toolwrapper1.relation_toolwrapper_to_option.append(opt1) opt1 = Option(name="param1", value="1") f1 = FileInputOutputInformation(file_key="input1", path="file1.txt") f1.relation_file_or_tableioinfo_to_typeio = self.input_entry f2 = FileInputOutputInformation(file_key="output1", path="file2.txt") f2.relation_file_or_tableioinfo_to_typeio = self.output_entry self.__toolwrapper2 = ToolWrapper(rule_name="rule2") self.__toolwrapper2.relation_toolwrapper_to_fileioinfo.extend([f1, f2]) self.__toolwrapper2.relation_toolwrapper_to_option.append(opt1) opt1 = Option(name="param2", value="2") f1 = FileInputOutputInformation(file_key="input1", path="file1.txt") f1.relation_file_or_tableioinfo_to_typeio = self.input_entry f2 = FileInputOutputInformation(file_key="output1", path="file2.txt") f2.relation_file_or_tableioinfo_to_typeio = self.output_entry self.__toolwrapper3 = ToolWrapper(rule_name="rule3") self.__toolwrapper3.relation_toolwrapper_to_fileioinfo.extend([f1, f2]) self.__toolwrapper3.relation_toolwrapper_to_option.append(opt1) # ToolWrappers for content_respected opt1 = Option(name="param1", value="2") f1 = FileInputOutputInformation(file_key="input1", path="file1.txt") f1.relation_file_or_tableioinfo_to_typeio = self.input_entry f2 = FileInputOutputInformation(file_key="output1", path="file2.txt") f2.relation_file_or_tableioinfo_to_typeio = self.output_entry t1 = TableInputOutputInformation(model_py_path="FooBase", table_key="FooBase", table_name="FooBase") t1.set_table(FooBase) t1.model_declarative_meta = FooBase t1.table = t1 t1.relation_file_or_tableioinfo_to_typeio = self.input_entry t2 = TableInputOutputInformation(model_py_path="FooBase", table_key="FooBase", table_name="FooBase") t2.set_table(FooBase) t2.model_declarative_meta = FooBase t2.table = t2 t2.relation_file_or_tableioinfo_to_typeio = self.output_entry self.__foowrapper_right_content = FooWrapper3(rule_name="rule1") self.__foowrapper_right_content.relation_toolwrapper_to_fileioinfo.extend([f1, f2]) self.__foowrapper_right_content.relation_toolwrapper_to_tableioinfo.extend([t1, t2]) self.__foowrapper_right_content.relation_toolwrapper_to_option.append(opt1) opt1 = Option(name="param1", value="String") f1 = FileInputOutputInformation(file_key="input1", path="file1.txt") f1.relation_file_or_tableioinfo_to_typeio = self.input_entry f2 = FileInputOutputInformation(file_key="output1", path="file2.txt") f2.relation_file_or_tableioinfo_to_typeio = self.output_entry t1 = TableInputOutputInformation(model_py_path="FooBase", table_key="FooBase", table_name="FooBase") # t1.set_table(FooBase) t1.model_declarative_meta = FooBase t1.table = t1 t2 = TableInputOutputInformation(model_py_path="FooBase", table_key="FooBase", table_name="FooBase") # t2.set_table(FooBase) t2.model_declarative_meta = FooBase t2.table = t2 self.__foowrapper_wrong_content1 = FooWrapper3(rule_name="rule2") self.__foowrapper_wrong_content1.relation_toolwrapper_to_fileioinfo.extend([f1, f2]) self.__foowrapper_wrong_content1.relation_toolwrapper_to_tableioinfo.extend([t1, t2]) self.__foowrapper_wrong_content1.relation_toolwrapper_to_option.append(opt1) opt1 = Option(name="param2", value="2") f1 = FileInputOutputInformation(file_key="input1", path="file1.txt") f1.relation_file_or_tableioinfo_to_typeio = self.input_entry f2 = FileInputOutputInformation(file_key="output1", path="file2.txt") f2.relation_file_or_tableioinfo_to_typeio = self.output_entry f3 = FileInputOutputInformation(file_key="input2", path="file2.txt") f3.relation_file_or_tableioinfo_to_typeio = self.input_entry t1 = TableInputOutputInformation(model_py_path="FooBase", table_key="FooBase", table_name="FooBase") # t1.set_table(FooBase) t1.model_declarative_meta = FooBase t1.table = t1 t2 = TableInputOutputInformation(model_py_path="FooBase", table_key="FooBase", table_name="FooBase") # t2.set_table(FooBase) t2.model_declarative_meta = FooBase t2.table = t2 self.__foowrapper_wrong_content2 = FooWrapper3(rule_name="rule3") self.__foowrapper_wrong_content2.relation_toolwrapper_to_fileioinfo.extend([f1, f2, f3]) self.__foowrapper_wrong_content2.relation_toolwrapper_to_tableioinfo.extend([t1, t2]) self.__foowrapper_wrong_content2.relation_toolwrapper_to_option.append(opt1) opt1 = Option(name="param2", value="2") f1 = FileInputOutputInformation(file_key="input1", path="file1.txt") f1.relation_file_or_tableioinfo_to_typeio = self.input_entry f2 = FileInputOutputInformation(file_key="output1", path="file2.txt") f2.relation_file_or_tableioinfo_to_typeio = self.output_entry t1 = TableInputOutputInformation(model_py_path="FooBase", table_key="FooBase", table_name="FooBase") # t1.set_table(FooBase) t1.model_declarative_meta = FooBase t1.table = t1 t2 = TableInputOutputInformation(model_py_path="FooBase", table_key="FooBase", table_name="FooBase") # t2.set_table(FooBase) t2.model_declarative_meta = FooBase t2.table = t2 self.__foowrapper_wrong_content3 = FooWrapper3(rule_name="rule3") self.__foowrapper_wrong_content3.relation_toolwrapper_to_fileioinfo.extend([f1, f2]) self.__foowrapper_wrong_content3.relation_toolwrapper_to_tableioinfo.extend([t1, t2]) self.__foowrapper_wrong_content3.relation_toolwrapper_to_option.append(opt1) opt1 = Option(name="param1", value="String") f1 = FileInputOutputInformation(file_key="input1", path="file1.txt") f1.relation_file_or_tableioinfo_to_typeio = self.input_entry f2 = FileInputOutputInformation(file_key="output1", path="file2.txt") f2.relation_file_or_tableioinfo_to_typeio = self.output_entry t1 = TableInputOutputInformation(model_py_path="FooBase", table_key="FooBase", table_name="FooBase") # t1.set_table(FooBase) t1.model_declarative_meta = FooBase t1.table = t1 t2 = TableInputOutputInformation(model_py_path="FooBase", table_key="FooBase", table_name="FooBase") # t2.set_table(FooBase) t2.model_declarative_meta = FooBase t2.table = t2 self.__foowrapper_wrong_content4 = FooWrapper3(rule_name="rule3") self.__foowrapper_wrong_content4.relation_toolwrapper_to_fileioinfo.extend([f1, f2]) self.__foowrapper_wrong_content4.relation_toolwrapper_to_tableioinfo.extend([t1, t2]) self.__foowrapper_wrong_content4.relation_toolwrapper_to_option.append(opt1) f1 = FileInputOutputInformation(file_key="input1", path="file1.txt") f1.relation_file_or_tableioinfo_to_typeio = self.input_entry f2 = FileInputOutputInformation(file_key="output1", path="file2.txt") f2.relation_file_or_tableioinfo_to_typeio = self.output_entry t1 = TableInputOutputInformation(model_py_path="FooBase", table_key="FooBase", table_name="FooBase") # t1.set_table(FooBase) t1.model_declarative_meta = FooBase t1.table = t1 t2 = TableInputOutputInformation(model_py_path="FooBase", table_key="FooBase", table_name="FooBase") # t2.set_table(FooBase) t2.model_declarative_meta = FooBase t2.table = t2 self.__foowrapper_wrong_content5 = FooWrapper3(rule_name="rule3") self.__foowrapper_wrong_content5.relation_toolwrapper_to_fileioinfo.extend([f1, f2]) self.__foowrapper_wrong_content5.relation_toolwrapper_to_tableioinfo.extend([t1, t2]) # TooLWrappers for follows f1 = FileInputOutputInformation(file_key="input1", path="file1.txt") f1.relation_file_or_tableioinfo_to_typeio = self.input_entry f2 = FileInputOutputInformation(file_key="output1", path="file2.txt") f2.relation_file_or_tableioinfo_to_typeio = self.output_entry self.__toolwrapper_first = FooWrapper2(rule_name="rule1") self.__toolwrapper_first.relation_toolwrapper_to_fileioinfo.extend([f1, f2]) f1 = FileInputOutputInformation(file_key="input1", path="file2.txt") f1.relation_file_or_tableioinfo_to_typeio = self.input_entry f2 = FileInputOutputInformation(file_key="output1", path="file3.txt") f2.relation_file_or_tableioinfo_to_typeio = self.output_entry self.__toolwrapper_second = FooWrapper2(rule_name="rule2") self.__toolwrapper_second.relation_toolwrapper_to_fileioinfo.extend([f1, f2]) # ToolWrappers for are_input_ready s_path_to_example_file_that_exists = os.path.join(self.test_path, "resource/input_files/input_file1.txt") f1 = FileInputOutputInformation(file_key="input1", path=s_path_to_example_file_that_exists) f1.relation_file_or_tableioinfo_to_typeio = self.input_entry f2 = FileInputOutputInformation(file_key="output1", path="file2.txt") f2.relation_file_or_tableioinfo_to_typeio = self.output_entry self.__toolwrapper_ready = FooWrapper2(rule_name="rule2") self.__toolwrapper_ready.relation_toolwrapper_to_fileioinfo.extend([f1, f2]) f1 = FileInputOutputInformation(file_key="input1", path="/not/existent/file") f1.relation_file_or_tableioinfo_to_typeio = self.input_entry f2 = FileInputOutputInformation(file_key="output1", path="file2.txt") f2.relation_file_or_tableioinfo_to_typeio = self.output_entry self.__toolwrapper_not_ready = FooWrapper2(rule_name="rule2") self.__toolwrapper_not_ready.relation_toolwrapper_to_fileioinfo.extend([f1, f2])
def setUp(self): self.test_path = PathManager.get_test_path() self.outdir_path = os.path.join(self.test_path, 'outdir') pathlib.Path(self.outdir_path).mkdir(exist_ok=True, parents=True)
def tearDown(self): SQLManager.instance().get_session().close() SQLManager.instance().drop_all() OptionManager._drop() PathManager.unlink("tests/outdir/output_file1.txt") SQLManager._drop()