Skip to content

Commit

Permalink
Force file registry to download every time
Browse files Browse the repository at this point in the history
  • Loading branch information
sfmig committed Dec 12, 2024
1 parent 3200b39 commit f3740b7
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions tests/fixtures/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,28 @@ def pooch_registry() -> dict:
URL and hash of the GIN repository with the test data
"""
# Cache the test data in the user's home directory
test_data_dir = Path.home() / ".crabs-exploration-test-data"

# Remove the file registry if it exists
# otherwise the registry is not downloaded everytime
file_registry_path = test_data_dir / "files-registry.txt"
if file_registry_path.is_file():
Path(file_registry_path).unlink()

# Initialise pooch registry
registry = pooch.create(
Path.home() / ".crabs-exploration-test-data",
test_data_dir,
base_url=f"{GIN_TEST_DATA_REPO}/raw/master/test_data",
)

# Download only the registry file from GIN
# if known_hash = None, the file is always downloaded.
# (this file should always be downloaded fresh from GIN)
file_registry = pooch.retrieve(
url=f"{GIN_TEST_DATA_REPO}/raw/master/files-registry.txt",
known_hash=None,
fname="files-registry.txt",
# we need to pass a filename otherwise the file is not overwritten
# every time!
# From the docs: if fname=None, will create a unique file name using
# a combination of the last part of the URL (assuming it’s the file
# name) and the MD5 hash of the URL. So if fname=None, the file won't
# be overwritten while the URL stays the same, even if the content
# changes.
path=Path.home() / ".crabs-exploration-test-data",
fname=file_registry_path.name,
path=file_registry_path.parent,
)

# Load registry file onto pooch registry
Expand Down

0 comments on commit f3740b7

Please sign in to comment.