Skip to content

Commit

Permalink
refactor in test
Browse files Browse the repository at this point in the history
  • Loading branch information
tarilabs committed Dec 8, 2024
1 parent fcc0a3a commit ba1df7d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/basic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ def test_single_file_tar(tmp_path):
with tarfile.open(fileobj=writer, mode="w") as tar:
tar.add(hello_path, arcname=hello_path.name)

checksum2 = get_file_hash(temp_tar_filename)
print(f"to double-check, here is the checksum of .tar.gz re-reading it: {checksum2}")

checksum = writer.hash_func.hexdigest()
print(f"digest of the tar file: {checksum}")
assert checksum == "08e87bd00a65bebed3cabc34b4cf9a005b3bf31c25078ebd44a30fa1ad0778e3"

checksum2 = get_file_hash(temp_tar_filename)
print(f"to double-check, here is the checksum of .tar.gz re-reading it: {checksum2}")

final_tar_filename = f"{checksum}.tar"
os.rename(temp_tar_filename, sha256_path / final_tar_filename)
print(f"tar file renamed to: {final_tar_filename}")
Expand All @@ -46,16 +46,16 @@ def test_single_file_gz(tmp_path):
with tarfile.open(fileobj=inner_writer, mode="w") as tar:
tar.add(hello_path, arcname=hello_path.name)

checksum2 = get_file_hash(temp_tar_filename)
print(f"to double-check, here is the checksum of .tar.gz re-reading it: {checksum2}")

tar_checksum = inner_writer.hash_func.hexdigest()
print(f"digest of the tar file: {tar_checksum}")
assert tar_checksum == "08e87bd00a65bebed3cabc34b4cf9a005b3bf31c25078ebd44a30fa1ad0778e3"
checksum = writer.hash_func.hexdigest()
print(f"digest of the tar.gz file: {checksum}")
assert checksum == "42ebad9bfd3ace9ea36c96957b41a0ab3d8f7b0528700a1a154887c459b33587"

checksum2 = get_file_hash(temp_tar_filename)
print(f"to double-check, here is the checksum of .tar.gz re-reading it: {checksum2}")

final_tar_filename = f"{checksum}.tar.gz"
os.rename(temp_tar_filename, sha256_path / final_tar_filename)
print(f"tar file renamed to: {final_tar_filename}")
Expand Down

0 comments on commit ba1df7d

Please sign in to comment.