From 4c618bcd02cb5db63076e2140fae2b54477cfa4a Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Fri, 20 Oct 2023 12:52:26 +0200 Subject: [PATCH 01/15] Test new Zenodo-download procedure (ref #583) --- .github/workflows/ci_poetry.yml | 3 ++ .github/workflows/download_zenodo_data.yml | 12 ++++++++ tests/data/download_zenodo_data.sh | 32 ++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 .github/workflows/download_zenodo_data.yml create mode 100644 tests/data/download_zenodo_data.sh diff --git a/.github/workflows/ci_poetry.yml b/.github/workflows/ci_poetry.yml index cf32e7850..b26fc9590 100644 --- a/.github/workflows/ci_poetry.yml +++ b/.github/workflows/ci_poetry.yml @@ -42,6 +42,9 @@ jobs: - name: Install dependencies (without extras) run: poetry install --with dev --without docs --no-interaction + - name: Download Zenodo data + uses: ./.github/workflows/download_zenodo_data.yml + - name: Test core library with pytest run: poetry run coverage run -m pytest tests --ignore tests/tasks diff --git a/.github/workflows/download_zenodo_data.yml b/.github/workflows/download_zenodo_data.yml new file mode 100644 index 000000000..491c86c3f --- /dev/null +++ b/.github/workflows/download_zenodo_data.yml @@ -0,0 +1,12 @@ +name: Download Zenodo data +on: [workflow_call] +jobs: + zenodo: + name: "Download Zenodo data" + runs-on: ubuntu-22 + timeout-minutes: 5 + steps: + - name: Install jq + uses: dcarbone/install-jq-action@v2.0.2 + - name: Test core library with pytest + run: bash tests/data/download_zenodo_data.sh diff --git a/tests/data/download_zenodo_data.sh b/tests/data/download_zenodo_data.sh new file mode 100644 index 000000000..f5221742e --- /dev/null +++ b/tests/data/download_zenodo_data.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +LIST_RECORD_ID="7059515 8091756" + +for RECORD_ID in $LIST_RECORD_ID; do + echo "****************************" + echo "START RECORD_ID=$RECORD_ID" + OUTPUT_FOLDER=tests/data/10_5281_zenodo_$RECORD_ID + echo "OUTPUT_FOLDER: $OUTPUT_FOLDER" + + if [ -d $OUTPUT_FOLDER ]; then + echo "OUTPUT_FOLDER already exists. Exit." + else + mkdir $OUTPUT_FOLDER + FILES=`curl https://zenodo.org/api/records/$RECORD_ID | jq -r ".files[].links.download"` + echo "curl exit code: $?" + for FILE in $FILES; do + FILEPATH=${FILE%"/content"} + FILENAME=`basename $FILEPATH` + echo "FILE: $FILE" + echo "FILEPATH: $FILEPATH" + echo "FILENAME: $FILENAME" + echo + wget $FILE --output-document=${OUTPUT_FOLDER}/${FILENAME} + echo + done + fi + + echo "END RECORD_ID=$RECORD_ID" + echo "****************************" + echo +done From 8df5a71671da59d4092f56d79ed0b633b84e01a5 Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Fri, 20 Oct 2023 12:56:06 +0200 Subject: [PATCH 02/15] Update github action --- .github/workflows/ci_poetry.yml | 2 +- .github/workflows/download_zenodo_data.yml | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 .github/workflows/download_zenodo_data.yml diff --git a/.github/workflows/ci_poetry.yml b/.github/workflows/ci_poetry.yml index b26fc9590..5653cc57c 100644 --- a/.github/workflows/ci_poetry.yml +++ b/.github/workflows/ci_poetry.yml @@ -43,7 +43,7 @@ jobs: run: poetry install --with dev --without docs --no-interaction - name: Download Zenodo data - uses: ./.github/workflows/download_zenodo_data.yml + run: bash tests/data/download_zenodo_data.sh - name: Test core library with pytest run: poetry run coverage run -m pytest tests --ignore tests/tasks diff --git a/.github/workflows/download_zenodo_data.yml b/.github/workflows/download_zenodo_data.yml deleted file mode 100644 index 491c86c3f..000000000 --- a/.github/workflows/download_zenodo_data.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Download Zenodo data -on: [workflow_call] -jobs: - zenodo: - name: "Download Zenodo data" - runs-on: ubuntu-22 - timeout-minutes: 5 - steps: - - name: Install jq - uses: dcarbone/install-jq-action@v2.0.2 - - name: Test core library with pytest - run: bash tests/data/download_zenodo_data.sh From 1aff5092662f1235a8e6edd04571588ff9cd39b1 Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Fri, 20 Oct 2023 12:57:21 +0200 Subject: [PATCH 03/15] Add wget --no-verbose option --- tests/data/download_zenodo_data.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/data/download_zenodo_data.sh b/tests/data/download_zenodo_data.sh index f5221742e..5513e2ec7 100644 --- a/tests/data/download_zenodo_data.sh +++ b/tests/data/download_zenodo_data.sh @@ -21,7 +21,7 @@ for RECORD_ID in $LIST_RECORD_ID; do echo "FILEPATH: $FILEPATH" echo "FILENAME: $FILENAME" echo - wget $FILE --output-document=${OUTPUT_FOLDER}/${FILENAME} + wget --no-verbose $FILE --output-document=${OUTPUT_FOLDER}/${FILENAME} echo done fi From fc2c85d8ba8656e43dfe5a6d9acab8e8115f6e76 Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Fri, 20 Oct 2023 13:00:06 +0200 Subject: [PATCH 04/15] Add caching --- .github/workflows/ci_poetry.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/ci_poetry.yml b/.github/workflows/ci_poetry.yml index 5653cc57c..4ae2f78d0 100644 --- a/.github/workflows/ci_poetry.yml +++ b/.github/workflows/ci_poetry.yml @@ -42,7 +42,15 @@ jobs: - name: Install dependencies (without extras) run: poetry install --with dev --without docs --no-interaction + - name: Cache Zenodo data + id: cache-zenodo-data + uses: actions/cache@v3 + with: + path: tests/data/ + key: zenodo-data + - name: Download Zenodo data + if: steps.cache-zenodo-data.outputs.cache-hit != 'true' run: bash tests/data/download_zenodo_data.sh - name: Test core library with pytest @@ -91,6 +99,17 @@ jobs: - name: Check manifest task metadata run: poetry run python fractal_tasks_core/dev/check_manifest.py + - name: Cache Zenodo data + id: cache-zenodo-data + uses: actions/cache@v3 + with: + path: tests/data/ + key: zenodo-data + + - name: Download Zenodo data + if: steps.cache-zenodo-data.outputs.cache-hit != 'true' + run: bash tests/data/download_zenodo_data.sh + - name: Test tasks with pytest run: poetry run coverage run -m pytest tests/tasks From 87a57fe5c25e3d015e67110e436b97436ce4bb7c Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Fri, 20 Oct 2023 13:01:47 +0200 Subject: [PATCH 05/15] Trigger ci --- x | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 x diff --git a/x b/x new file mode 100644 index 000000000..e69de29bb From 246567819f9799a40b8ee208edf2cf8f15a4379e Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Fri, 20 Oct 2023 13:02:01 +0200 Subject: [PATCH 06/15] Revert last dummy commit --- x | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 x diff --git a/x b/x deleted file mode 100644 index e69de29bb..000000000 From 157867898aac6d970a0e66514a46916d80638ae4 Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Fri, 20 Oct 2023 13:24:20 +0200 Subject: [PATCH 07/15] Add echo --- tests/data/download_zenodo_data.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/data/download_zenodo_data.sh b/tests/data/download_zenodo_data.sh index 5513e2ec7..cecbc56ad 100644 --- a/tests/data/download_zenodo_data.sh +++ b/tests/data/download_zenodo_data.sh @@ -14,6 +14,7 @@ for RECORD_ID in $LIST_RECORD_ID; do mkdir $OUTPUT_FOLDER FILES=`curl https://zenodo.org/api/records/$RECORD_ID | jq -r ".files[].links.download"` echo "curl exit code: $?" + echo for FILE in $FILES; do FILEPATH=${FILE%"/content"} FILENAME=`basename $FILEPATH` @@ -24,6 +25,11 @@ for RECORD_ID in $LIST_RECORD_ID; do wget --no-verbose $FILE --output-document=${OUTPUT_FOLDER}/${FILENAME} echo done + + if [ $RECORD_ID == "8091756" ]; then + unzip tests/data/10_5281_zenodo_8091756/20200812-CardiomyocyteDifferentiation14-Cycle1.zarr.zip -d tests/data/10_5281_zenodo_8091756 + unzip tests/data/10_5281_zenodo_8091756/20200812-CardiomyocyteDifferentiation14-Cycle1_mip.zarr.zip -d tests/data/10_5281_zenodo_8091756 + fi fi echo "END RECORD_ID=$RECORD_ID" From 26fbf702c3078786274619482a38624d909e58a3 Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Fri, 20 Oct 2023 13:43:59 +0200 Subject: [PATCH 08/15] Update zenodo fixtures and download script --- tests/conftest.py | 93 +++++++++++++----------------- tests/data/download_zenodo_data.sh | 1 + 2 files changed, 41 insertions(+), 53 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 931acc172..4a2d4f3b4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,13 +1,19 @@ import json +import logging import os import shutil import time from pathlib import Path -from urllib.parse import unquote +import anndata as ad import pytest import requests # type: ignore import wget +import zarr +from devtools import debug + +from fractal_tasks_core.lib_regions_of_interest import reset_origin +from fractal_tasks_core.lib_write import write_table @pytest.fixture(scope="session") @@ -17,48 +23,38 @@ def testdata_path() -> Path: @pytest.fixture(scope="function") -def zenodo_images(testdata_path, capsys): +def zenodo_images(testdata_path): """ Inspired by https://github.com/dvolgyes/zenodo_get/blob/master/zenodo_get/zget.py - - See https://docs.pytest.org/en/7.4.x/how-to/capture-stdout-stderr.html for - the use of capsys """ - t_start = time.perf_counter() - url = "10.5281/zenodo.7059515" - folder = str(testdata_path / (url.replace(".", "_").replace("/", "_"))) + # Download images and metadata files + recordID = "7059515" + url = "10_5281_zenodo_7059515" + folder = str(testdata_path / f"10_5281_zenodo_{recordID}") if os.path.isdir(folder): - print(f"{folder} already exists, skip") - return folder - os.makedirs(folder) - url = "https://doi.org/" + url - print(f"I will download {url} files to {folder}") - - r = requests.get(url) - recordID = r.url.split("/")[-1] - url = "https://zenodo.org/api/records/" - r = requests.get(url + recordID) - - js = json.loads(r.text) - files = js["files"] - for f in files: - fname = f["filename"] - link = f"https://zenodo.org/record/{recordID}/files/{fname}" - print(link) - link = unquote(link) - wget.download(link, out=folder) - print() + print(f"{folder} already exists, skip download") + else: + os.makedirs(folder) + url = f"https://zenodo.org/api/records/{recordID}" + r = requests.get(url) + js = json.loads(r.text) + files = js["files"] + for f in files: + file_url = f["links"]["download"] + file_name = file_url.split("/")[-2] + wget.download(file_url, out=f"{folder}/{file_name}", bar=False) # Add an image with invalid name, that should be skipped during parsing with open(f"{folder}/invalid_path.png", "w") as f: f.write("This file has an invalid filename, which cannot be parsed.") t_end = time.perf_counter() - with capsys.disabled(): - print(f"\n Time spent in zenodo_images: {t_end-t_start:.2f} s") + logging.warning( + f"\n Time spent in zenodo_images: {t_end-t_start:.2f} s" + ) return folder @@ -78,12 +74,8 @@ def zenodo_images_multiplex(testdata_path, zenodo_images): return cycle_folders -@pytest.fixture(scope="function") -def zenodo_zarr(testdata_path, tmpdir_factory, capsys): - """ - See https://docs.pytest.org/en/7.4.x/how-to/capture-stdout-stderr.html for - the use of capsys - """ +@pytest.fixture(scope="session") +def zenodo_zarr(testdata_path, tmpdir_factory): t_start = time.perf_counter() doi = "10.5281/zenodo.8091756" @@ -91,33 +83,30 @@ def zenodo_zarr(testdata_path, tmpdir_factory, capsys): platenames = ["plate.zarr", "plate_mip.zarr"] folders = [rootfolder / plate for plate in platenames] + # Download dataset if rootfolder.exists(): - print(f"{str(rootfolder)} already exists, skip") - folders = [str(f) for f in folders] - return folders + print(f"{str(rootfolder)} already exists, skip download part") else: - - import zarr - import anndata as ad - import logging - - from fractal_tasks_core.lib_regions_of_interest import reset_origin - from fractal_tasks_core.lib_write import write_table - rootfolder.mkdir() tmp_path = tmpdir_factory.mktemp("zenodo_zarr") zarrnames = [ "20200812-CardiomyocyteDifferentiation14-Cycle1.zarr", "20200812-CardiomyocyteDifferentiation14-Cycle1_mip.zarr", ] - for zarrname, folder in zip(zarrnames, folders): + for zarrname in zarrnames: zipname = f"{zarrname}.zip" url = f"https://zenodo.org/record/8091756/files/{zipname}" + debug(url) wget.download(url, out=str(tmp_path / zipname), bar=None) shutil.unpack_archive( - str(tmp_path / zipname), extract_dir=rootfolder, format="zip" + str(tmp_path / zipname), + extract_dir=rootfolder, + format="zip", ) - shutil.move(str(rootfolder / zarrname), str(folder)) + + # Rename and update OME-Zarr + for zarrname, folder in zip(zarrnames, folders): + shutil.copytree(str(rootfolder / zarrname), str(folder)) # Update well/FOV ROI tables, by shifting their origin to 0 # TODO: remove this fix, by uploading new zarrs to zenodo (ref @@ -139,9 +128,7 @@ def zenodo_zarr(testdata_path, tmpdir_factory, capsys): folders = [str(f) for f in folders] t_end = time.perf_counter() - with capsys.disabled(): - print(f"\n Time spent in zenodo_zarr: {t_end-t_start:.2f} s") - + logging.warning(f"\n Time spent in zenodo_zarr: {t_end-t_start:.2f} s") return folders diff --git a/tests/data/download_zenodo_data.sh b/tests/data/download_zenodo_data.sh index cecbc56ad..c6e868c34 100644 --- a/tests/data/download_zenodo_data.sh +++ b/tests/data/download_zenodo_data.sh @@ -1,5 +1,6 @@ #!/bin/bash +LIST_RECORD_ID="7059515 8091756" LIST_RECORD_ID="7059515 8091756" for RECORD_ID in $LIST_RECORD_ID; do From 90b94697c17550ee0e28bcfff2fc41781c695a00 Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Fri, 20 Oct 2023 13:48:27 +0200 Subject: [PATCH 09/15] Add time.sleep in zenodo_zarr fixture --- tests/conftest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/conftest.py b/tests/conftest.py index 4a2d4f3b4..0866a8f6f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -98,6 +98,7 @@ def zenodo_zarr(testdata_path, tmpdir_factory): url = f"https://zenodo.org/record/8091756/files/{zipname}" debug(url) wget.download(url, out=str(tmp_path / zipname), bar=None) + time.sleep(0.5) shutil.unpack_archive( str(tmp_path / zipname), extract_dir=rootfolder, From a0158d406c83b13e85a5db8f2e2e97543c02d6a0 Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Fri, 20 Oct 2023 13:51:45 +0200 Subject: [PATCH 10/15] Clean up zenodo fixtures --- tests/conftest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 0866a8f6f..b9b634a2c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -22,7 +22,7 @@ def testdata_path() -> Path: return TEST_DIR / "data/" -@pytest.fixture(scope="function") +@pytest.fixture(scope="session") def zenodo_images(testdata_path): """ Inspired by @@ -59,7 +59,7 @@ def zenodo_images(testdata_path): return folder -@pytest.fixture(scope="function") +@pytest.fixture(scope="session") def zenodo_images_multiplex(testdata_path, zenodo_images): folder = str(testdata_path / "fake_multiplex") cycle_folder_1 = str(Path(folder) / "cycle1") @@ -107,6 +107,7 @@ def zenodo_zarr(testdata_path, tmpdir_factory): # Rename and update OME-Zarr for zarrname, folder in zip(zarrnames, folders): + shutil.rmtree(str(folder)) shutil.copytree(str(rootfolder / zarrname), str(folder)) # Update well/FOV ROI tables, by shifting their origin to 0 From be06f2b54e4522a911bfddf59c92d6fc0fd90d64 Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Fri, 20 Oct 2023 13:57:07 +0200 Subject: [PATCH 11/15] Clean up zenodo_zarrs fixture --- tests/conftest.py | 50 ++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index b9b634a2c..f2a0eeac6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -82,6 +82,10 @@ def zenodo_zarr(testdata_path, tmpdir_factory): rootfolder = testdata_path / (doi.replace(".", "_").replace("/", "_")) platenames = ["plate.zarr", "plate_mip.zarr"] folders = [rootfolder / plate for plate in platenames] + zarrnames = [ + "20200812-CardiomyocyteDifferentiation14-Cycle1.zarr", + "20200812-CardiomyocyteDifferentiation14-Cycle1_mip.zarr", + ] # Download dataset if rootfolder.exists(): @@ -89,10 +93,6 @@ def zenodo_zarr(testdata_path, tmpdir_factory): else: rootfolder.mkdir() tmp_path = tmpdir_factory.mktemp("zenodo_zarr") - zarrnames = [ - "20200812-CardiomyocyteDifferentiation14-Cycle1.zarr", - "20200812-CardiomyocyteDifferentiation14-Cycle1_mip.zarr", - ] for zarrname in zarrnames: zipname = f"{zarrname}.zip" url = f"https://zenodo.org/record/8091756/files/{zipname}" @@ -105,27 +105,29 @@ def zenodo_zarr(testdata_path, tmpdir_factory): format="zip", ) - # Rename and update OME-Zarr - for zarrname, folder in zip(zarrnames, folders): + # Based on the Zenodo OME-Zarrs, create the appropriate OME-Zarrs to be + # used in tests + for zarrname, folder in zip(zarrnames, folders): + if os.path.isdir(str(folder)): shutil.rmtree(str(folder)) - shutil.copytree(str(rootfolder / zarrname), str(folder)) - - # Update well/FOV ROI tables, by shifting their origin to 0 - # TODO: remove this fix, by uploading new zarrs to zenodo (ref - # issue 526) - image_group_path = folder / "B/03/0" - group_image = zarr.open_group(str(image_group_path)) - for table_name in ["FOV_ROI_table", "well_ROI_table"]: - table_path = str(image_group_path / "tables" / table_name) - old_table = ad.read_zarr(table_path) - new_table = reset_origin(old_table) - write_table( - group_image, - table_name, - new_table, - overwrite=True, - logger=logging.getLogger(), - ) + shutil.copytree(str(rootfolder / zarrname), str(folder)) + + # Update well/FOV ROI tables, by shifting their origin to 0 + # TODO: remove this fix, by uploading new zarrs to zenodo (ref + # issue 526) + image_group_path = folder / "B/03/0" + group_image = zarr.open_group(str(image_group_path)) + for table_name in ["FOV_ROI_table", "well_ROI_table"]: + table_path = str(image_group_path / "tables" / table_name) + old_table = ad.read_zarr(table_path) + new_table = reset_origin(old_table) + write_table( + group_image, + table_name, + new_table, + overwrite=True, + logger=logging.getLogger(), + ) folders = [str(f) for f in folders] From 82f987f55628c01d37f5853247f73e6becf8462c Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Fri, 20 Oct 2023 14:00:22 +0200 Subject: [PATCH 12/15] Also cache Zenodo data in pip CI --- .github/workflows/ci_pip.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/ci_pip.yml b/.github/workflows/ci_pip.yml index eaf07fb55..f4e41bc4f 100644 --- a/.github/workflows/ci_pip.yml +++ b/.github/workflows/ci_pip.yml @@ -35,6 +35,17 @@ jobs: - name: Install some testing dependencies (hard-coded) run: python -m pip install pytest devtools jsonschema requests wget + - name: Cache Zenodo data + id: cache-zenodo-data + uses: actions/cache@v3 + with: + path: tests/data/ + key: zenodo-data + + - name: Download Zenodo data + if: steps.cache-zenodo-data.outputs.cache-hit != 'true' + run: bash tests/data/download_zenodo_data.sh + - name: Test core library with pytest run: pytest tests --ignore tests/tasks @@ -65,5 +76,16 @@ jobs: - name: Install some testing dependencies (hard-coded) run: python -m pip install pytest devtools jsonschema requests wget + - name: Cache Zenodo data + id: cache-zenodo-data + uses: actions/cache@v3 + with: + path: tests/data/ + key: zenodo-data + + - name: Download Zenodo data + if: steps.cache-zenodo-data.outputs.cache-hit != 'true' + run: bash tests/data/download_zenodo_data.sh + - name: Test tasks with pytest run: pytest tests tests/tasks From 4c394eda994065ef654c66981f1c1f5d63932995 Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Fri, 20 Oct 2023 14:06:02 +0200 Subject: [PATCH 13/15] BROKEN add `raise` to fixture, to verify expected behavior --- tests/conftest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index f2a0eeac6..8f3ecee60 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -45,6 +45,7 @@ def zenodo_images(testdata_path): for f in files: file_url = f["links"]["download"] file_name = file_url.split("/")[-2] + raise ValueError("We are downloading data from zenodo_images") wget.download(file_url, out=f"{folder}/{file_name}", bar=False) # Add an image with invalid name, that should be skipped during parsing @@ -97,6 +98,7 @@ def zenodo_zarr(testdata_path, tmpdir_factory): zipname = f"{zarrname}.zip" url = f"https://zenodo.org/record/8091756/files/{zipname}" debug(url) + raise ValueError("We are downloading data from zenodo_zarr") wget.download(url, out=str(tmp_path / zipname), bar=None) time.sleep(0.5) shutil.unpack_archive( From 773cace77740f83612cf2e8d81209af2e20a7c31 Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Fri, 20 Oct 2023 14:07:56 +0200 Subject: [PATCH 14/15] Revert "BROKEN add `raise` to fixture, to verify expected behavior" This reverts commit 4c394eda994065ef654c66981f1c1f5d63932995. --- tests/conftest.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 8f3ecee60..f2a0eeac6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -45,7 +45,6 @@ def zenodo_images(testdata_path): for f in files: file_url = f["links"]["download"] file_name = file_url.split("/")[-2] - raise ValueError("We are downloading data from zenodo_images") wget.download(file_url, out=f"{folder}/{file_name}", bar=False) # Add an image with invalid name, that should be skipped during parsing @@ -98,7 +97,6 @@ def zenodo_zarr(testdata_path, tmpdir_factory): zipname = f"{zarrname}.zip" url = f"https://zenodo.org/record/8091756/files/{zipname}" debug(url) - raise ValueError("We are downloading data from zenodo_zarr") wget.download(url, out=str(tmp_path / zipname), bar=None) time.sleep(0.5) shutil.unpack_archive( From ce0c9d061640de8df3b241961a0c08d5b56e1855 Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Fri, 20 Oct 2023 14:10:03 +0200 Subject: [PATCH 15/15] Update CHANGELOG [skip ci] --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4810eeaa..d6946bb08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ **Note**: Numbers like (\#123) point to closed Pull Requests on the fractal-tasks-core repository. +# Unreleased + +* Testing: + * Cache Zenodo data, within GitHub actions (\#585). + # 0.13.0 * Tasks: