Пример #1
0
def test_calu_file_md5():
    # Github action fail on windows
    if sys.platform not in ("darwin", "linux"):
        return

    path = "temp-file"
    fd = open(path, "w")
    fd.write("asdf")

    cp = subprocess.run(_md5_cmd(path), universal_newlines=True, stdout=subprocess.PIPE)
    output = cp.stdout.strip()
    print("calu_file_md5: cmd output:", output)

    try:
        r = calu_file_md5(path)
        print("calu_file_md5:", r)
    finally:
        os.remove(path)
    assert r
Пример #2
0
def check_file_md5(localpath: str, pcs_file: PcsFile) -> bool:
    local_file_md5 = calu_file_md5(localpath)
    if local_file_md5 == pcs_file.md5:
        return True
    else:
        return False