Skip to content

Commit

Permalink
Save the evidence
Browse files Browse the repository at this point in the history
  • Loading branch information
ZainRizvi committed May 4, 2023
1 parent 08b4e02 commit 3d19143
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
13 changes: 4 additions & 9 deletions .github/scripts/pytest_cache.py
Expand Up @@ -42,17 +42,12 @@ def main():
if args.upload:
print(f"Uploading cache with args {args}")

# TODO: First check if it's even worth uploading a new cache:
# Does the cache even mark any failed tests?

# verify the cache dir exists
if not os.path.exists(args.cache_dir):
print(f"ZR: The given pytest cache dir `{args.cache_dir}` does not exist")
print("trying to cache it anyways")
# raise an invalid input exception
# raise ValueError(
# f"The given pytest cache dir `{args.cache_dir}` does not exist"
# )
print(f"The given pytest cache dir `{args.cache_dir}` does not exist. Skipping upload")

# TODO: First check if it's even worth uploading a new cache:
# Does the cache even mark any failed tests?

print(os.getenv("AWS_ACCESS_KEY_ID"))
upload_pytest_cache(
Expand Down
10 changes: 6 additions & 4 deletions .github/scripts/pytest_caching_utils.py
Expand Up @@ -79,7 +79,8 @@ def upload_pytest_cache(
if zip_file_path:
print(f"Deleting {zip_file_path}")
with contextlib.suppress(FileNotFoundError):
os.remove(zip_file_path)
pass
# os.remove(zip_file_path) # suppress deletes while testing


def download_pytest_cache(
Expand Down Expand Up @@ -128,11 +129,12 @@ def download_pytest_cache(
merge_pytest_caches(cache_dir_for_shard, dest_cache_dir)
finally:
# clean up the unzipped cache folder
shutil.rmtree(cache_dir_for_shard)
pass
# shutil.rmtree(cache_dir_for_shard) suppress deletes while testing
finally:
# clean up the downloaded zip files
shutil.rmtree(zip_download_dir)

# shutil.rmtree(zip_download_dir) suppress deletes while testing
pass

def copy_file(source_file, dest_file):
ensure_dir_exists(os.path.dirname(dest_file))
Expand Down

0 comments on commit 3d19143

Please sign in to comment.