def test_size(self, dependency1):
     checker = MD5Checker()
     state = checker.get_state(dependency1, None)
     state2 = (state[0] + 1, state[1] + 1, state[2])
     file_stat = os.stat(dependency1)
     # if size changed for sure modified (md5 is not checked)
     assert checker.check_modified(dependency1, file_stat, state2)
 def test_timestamp(self, dependency1):
     checker = MD5Checker()
     state = checker.get_state(dependency1, None)
     state2 = (state[0], state[1] + 1, '')
     file_stat = os.stat(dependency1)
     # dep considered the same as long as timestamp is unchanged
     assert not checker.check_modified(dependency1, file_stat, state2)
 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_md5(self, dependency1):
     checker = MD5Checker()
     state = checker.get_state(dependency1, None)
     file_stat = os.stat(dependency1)
     # same size and md5
     state2 = (state[0] + 1, state[1], state[2])
     assert not checker.check_modified(dependency1, file_stat, state2)
     # same size, different md5
     state3 = (state[0] + 1, state[1], 'not me')
     assert checker.check_modified(dependency1, file_stat, state3)