Skip to content

Commit fb42059

Browse files
authored
Merge pull request #568 from maps-as-data/update_ci_cd
Update ci/cd to work with IIIFDownloader
2 parents b647c1d + 77c782d commit fb42059

6 files changed

Lines changed: 30 additions & 27 deletions

File tree

.github/workflows/mr_ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
- name: Install dependencies
3535
run: |
3636
python -m pip install ".[dev]"
37+
python -m pip install 'git+https://github.com/rwood-97/piffle.git@iiif_dataclasses'
3738
python -m pip install pytest-cov
3839
3940
- name: Quality Assurance

.github/workflows/mr_ci_text_spotting.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
env:
1717
# point datasets to ~/.torch so it's cached by CI
1818
DETECTRON2_DATASETS: ~/.torch/datasets
19+
PYTHONIOENCODING: utf-8
1920

2021
runs-on: ${{ matrix.os }}
2122
steps:
@@ -48,6 +49,7 @@ jobs:
4849
python -m pip install 'git+https://github.com/maps-as-data/DeepSolo.git'
4950
python -m pip install 'git+https://github.com/maps-as-data/DPText-DETR.git'
5051
python -m pip install 'git+https://github.com/maps-as-data/MapTextPipeline.git'
52+
python -m pip install 'git+https://github.com/rwood-97/piffle.git@iiif_dataclasses'
5153
5254
5355
- name: Clone DPText-DETR

.github/workflows/mr_pip_ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
- name: Install dependencies
3737
run: |
3838
python -m pip install mapreader[dev]
39+
python -m pip install 'git+https://github.com/rwood-97/piffle.git@iiif_dataclasses'
3940
4041
- name: Quality Assurance
4142
run: |

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ The following table shows which versions of MapReader are compatible with which
1414
## Pre-release
1515
_Add new changes here_
1616

17+
### Added
18+
- Added tests for the `IIIFDownloader` class ([#568](https://github.com/maps-as-data/MapReader/pull/568))
1719

1820
## [v1.7.0](https://github.com/Living-with-machines/MapReader/releases/tag/v1.7.0) (2025-04-02)
1921

tests/test_download/skipped_test_iiif_downloader.py renamed to tests/test_download/test_iiif_downloader.py

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,12 @@ def test_iiif_uris(mock_get_manifest):
108108
iiif_uris="https://annotations.allmaps.org/manifests/a0d6d3379cfd9f0a",
109109
)
110110
assert isinstance(downloader, IIIFDownloader)
111-
assert (
112-
downloader.iiif[0].id
113-
== "https://annotations.allmaps.org/manifests/a0d6d3379cfd9f0a"
114-
)
111+
assert downloader.iiif[0].id is None
115112

116113

117114
def test_missing_id(mock_get_manifest):
118-
with pytest.raises(ValueError, match="missing an 'id' field"):
119-
IIIFDownloader("annotationpage3.json", 3)
115+
iiif_downloader = IIIFDownloader("annotationpage3.json", 3)
116+
assert isinstance(iiif_downloader, IIIFDownloader) # we want it to load fine
120117

121118

122119
def test_save_georeferenced_maps(tmp_path, mock_get_manifest, mock_download_image):
@@ -167,17 +164,17 @@ def test_save_georeferenced_map_from_str(
167164
assert src.crs.to_epsg() == 4326
168165

169166

170-
def test_save_georeferenced_map_value_error(
171-
tmp_path, mock_get_manifest, mock_download_image
172-
):
173-
downloader = IIIFDownloader(
174-
[],
175-
)
176-
with pytest.raises(ValueError, match="missing an 'id' field"):
177-
downloader.save_georeferenced_map(
178-
"annotationpage3.json",
179-
path_save=tmp_path,
180-
)
167+
# def test_save_georeferenced_map_value_error(
168+
# tmp_path, mock_get_manifest, mock_download_image
169+
# ):
170+
# downloader = IIIFDownloader(
171+
# [],
172+
# )
173+
# with pytest.raises(ValueError, match="missing an 'id' field"):
174+
# downloader.save_georeferenced_map(
175+
# "annotationpage3_missing_id.json",
176+
# path_save=tmp_path,
177+
# )
181178

182179

183180
def test_save_maps(tmp_path, mock_download_image, mock_get_manifest):
@@ -238,15 +235,15 @@ def test_save_map_from_str(tmp_path, mock_download_image, mock_get_manifest):
238235
assert all([file in os.listdir(tmp_path) for file in files])
239236

240237

241-
def test_save_map_value_error(tmp_path, mock_download_image, mock_get_manifest):
242-
downloader = IIIFDownloader(
243-
[],
244-
)
245-
with pytest.raises(ValueError, match="missing an 'id' field"):
246-
downloader.save_map(
247-
"annotationpage3.json",
248-
path_save=tmp_path,
249-
)
238+
# def test_save_map_value_error(tmp_path, mock_download_image, mock_get_manifest):
239+
# downloader = IIIFDownloader(
240+
# [],
241+
# )
242+
# with pytest.raises(ValueError, match="missing an 'id' field"):
243+
# downloader.save_map(
244+
# "annotationpage3_missing_id.json",
245+
# path_save=tmp_path,
246+
# )
250247

251248

252249
def test_save_map_unknown_class_error(tmp_path, mock_download_image, mock_get_manifest):

tests/test_import.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ def test_import():
1212
PatchContextDataset,
1313
Downloader,
1414
SheetDownloader,
15-
# IIIFDownloader,
15+
IIIFDownloader,
1616
)

0 commit comments

Comments
 (0)