def test_change_checker(self, pdep_manager, dependency1): t1 = Task("taskId_X", None, [dependency1]) pdep_manager.checker = TimestampChecker() pdep_manager.save_success(t1) assert 'up-to-date' == pdep_manager.get_status(t1, {}).status # change of checker force `run` again pdep_manager.checker = MD5Checker() assert 'run' == pdep_manager.get_status(t1, {}).status pdep_manager.save_success(t1) assert 'up-to-date' == pdep_manager.get_status(t1, {}).status
def test_file_dep_change_checker(self, depfile, dependency1): my_task = Task("t2", [""], file_dep=['tests/data/dependency1']) depfile.save_success(my_task) depfile.checker = TimestampChecker() output = StringIO() cmd_reset = CmdFactory(ResetDep, outstream=output, task_list=[my_task], dep_manager=depfile) cmd_reset._execute() got = output.getvalue() assert "processed t2\n" == got
def test_values_and_results(self, depfile, dependency1): my_task = Task("t2", [""], file_dep=['tests/data/dependency1']) my_task.result = "result" my_task.values = {'x': 5, 'y': 10} depfile.save_success(my_task) depfile.checker = TimestampChecker() # trigger task update reseted = Task("t2", [""], file_dep=['tests/data/dependency1']) output = StringIO() cmd_reset = CmdFactory(ResetDep, outstream=output, task_list=[reseted], dep_manager=depfile) cmd_reset._execute() got = output.getvalue() assert "processed t2\n" == got assert {'x': 5, 'y': 10} == depfile.get_values(reseted.name) assert get_md5('result') == depfile.get_result(reseted.name)
def test_timestamp(self, dependency1): checker = TimestampChecker() state = checker.get_state(dependency1, None) file_stat = os.stat(dependency1) assert not checker.check_modified(dependency1, file_stat, state) assert checker.check_modified(dependency1, file_stat, state + 1)
def test_timestamp(self, dependency1): checker = TimestampChecker() state = checker.get_state(dependency1, None) file_stat = os.stat(dependency1) assert not checker.check_modified(dependency1, file_stat, state) assert checker.check_modified(dependency1, file_stat, state+1)