def test_size_md5(self, dependency): timestamp = os.path.getmtime(dependency) size = os.path.getsize(dependency) md5 = md5sum(dependency) # incorrect size dont check md5 assert check_modified(dependency, (timestamp+1, size+1, '')) # correct size check md5 assert not check_modified(dependency, (timestamp+1, size, md5)) assert check_modified(dependency, (timestamp+1, size, ''))
def test_size_md5(self, dependency1): timestamp = os.path.getmtime(dependency1) size = os.path.getsize(dependency1) md5 = get_file_md5(dependency1) dep_stat = os.stat(dependency1) # incorrect size dont check md5 assert check_modified(dependency1, dep_stat, (timestamp+1, size+1, '')) # correct size check md5 assert not check_modified(dependency1, dep_stat, (timestamp+1, size, md5)) assert check_modified(dependency1, dep_stat, (timestamp+1, size, ''))
def test_size_md5(self, dependency1): timestamp = os.path.getmtime(dependency1) size = os.path.getsize(dependency1) md5 = get_file_md5(dependency1) dep_stat = os.stat(dependency1) # incorrect size dont check md5 assert check_modified(dependency1, dep_stat, (timestamp + 1, size + 1, '')) # correct size check md5 assert not check_modified(dependency1, dep_stat, (timestamp + 1, size, md5)) assert check_modified(dependency1, dep_stat, (timestamp + 1, size, ''))
def test_timestamp(self, dependency1): timestamp = os.path.getmtime(dependency1) dep_stat = os.stat(dependency1) assert not check_modified(dependency1, dep_stat, (timestamp, 0, '')) assert check_modified(dependency1, dep_stat, (timestamp+1, 0, ''))
def test_None(self, dependency1): assert check_modified(dependency1, os.stat(dependency1), None)
def test_timestamp(self, dependency): timestamp = os.path.getmtime(dependency) assert not check_modified(dependency, (timestamp, 0, '')) assert check_modified(dependency, (timestamp+1, 0, ''))
def test_None(self, dependency): assert check_modified(dependency, None)
def test_timestamp(self, dependency1): timestamp = os.path.getmtime(dependency1) dep_stat = os.stat(dependency1) assert not check_modified(dependency1, dep_stat, (timestamp, 0, '')) assert check_modified(dependency1, dep_stat, (timestamp + 1, 0, ''))