diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 733de82..6c79ba5 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -29,6 +29,9 @@ jobs: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Download testing data + run: | + python data/download.py - name: Test with pytest run: | pip install -r requirements-dev.txt diff --git a/data/download.py b/data/download.py index d050691..905da28 100755 --- a/data/download.py +++ b/data/download.py @@ -2,3 +2,32 @@ from urllib.request import urlretrieve import os + +script_dir = os.path.dirname(os.path.realpath(__file__)) + +# Data (file_name, sha512_hash) +data = [ + ( + "Cell_3phase.tif", + "645cb8970de3370fb15835107843710e799f72f58012003db35b056160ad4de995622e12727d0b739a8afd1586c3faa178f3b71c39bd4dbc9308e8ef5ebb8e11", + ), + ( + "Cell_5phase_small.tif", + "dd39269640efc251686f6e80bc42e3438e6f308274ca3d0b99e8da02f5976ad2cbd10cb594d2811631d0273413711096388b3a609eb41df2b04a1beeca4d91d1", + ), + ( + "PSF_3phase.tif", + "80cc81d668bdcc6847599bb7eab477dd169024093b07ab743154d2e6df86471d955fba1234c9d728d28e2000be72f1f19677dad8f0e710f9c26fee1c3c0d2a3d", + ), + ( + "PSF_5phase.tif", + "131f0621562a3832d270683c84d414acc20aacd7c1dae494dceef0cb156c170b6836f81544b80877978839a9eb82a882d3b5754040f6c098babd13be02f2d79e", + ), +] + +for file_name, sha512_hash in data: + file_path = os.path.join(script_dir, file_name) + if not os.path.exists(file_path): + print(f"Downloading {file_name}") + url = f"https://data.kitware.com/api/v1/file/hashsum/sha512/{sha512_hash}/download" + urlretrieve(url, file_path)