Skip to content

Commit 3932fdf

Browse files
committed
Merge branch 'main' into raise_filenotfounderror
2 parents 38b5bdb + 5daebd9 commit 3932fdf

File tree

4 files changed

+40
-37
lines changed

4 files changed

+40
-37
lines changed

.github/workflows/test-python.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,18 @@ jobs:
5656
python-version: ${{ matrix.python-version }}
5757

5858
- name: Install a specific version of uv
59-
uses: astral-sh/setup-uv@v3
59+
uses: astral-sh/setup-uv@v6
6060
with:
61-
enable-cache: true
62-
version: "0.5.x"
61+
version: "latest"
6362

6463
- name: uv sync
6564
working-directory: python
66-
run: uv sync --no-install-package geoindex-rs
65+
run: uv sync --no-install-package async-tiff
6766

6867
- name: maturin venv Build
6968
working-directory: python
7069
run: uv run --no-project maturin develop
7170

72-
# - name: Run pytest
73-
# working-directory: python
74-
# run: uv run --no-project pytest
71+
- name: Run pytest
72+
working-directory: python
73+
run: uv run --no-project pytest --verbose

python/pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ dev-dependencies = [
3333
"numpy>=1",
3434
"obstore>=0.5.1",
3535
"pip>=24.2",
36-
"pytest-asyncio>=0.24.0",
36+
"pytest-asyncio>=0.26.0",
3737
"pytest>=8.3.3",
3838
"ruff>=0.8.4",
3939
]
40+
41+
[tool.pytest.ini_options]
42+
addopts = "--color=yes"
43+
asyncio_default_fixture_loop_scope="function"
44+
asyncio_mode = "auto"

python/tests/test_cog.py

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,30 @@
1-
import async_tiff
2-
from time import time
3-
41
import pytest
52

6-
from async_tiff import TIFF
3+
from async_tiff import TIFF, enums
74
from async_tiff.store import LocalStore, S3Store
85

9-
store = S3Store("sentinel-cogs", region="us-west-2", skip_signature=True)
10-
path = "sentinel-s2-l2a-cogs/12/S/UF/2022/6/S2B_12SUF_20220609_0_L2A/B04.tif"
11-
12-
tiff = await TIFF.open(path, store=store, prefetch=32768)
13-
14-
start = time()
15-
tiff = await TIFF.open(path, store=store, prefetch=32768)
16-
end = time()
17-
end - start
186

19-
ifds = tiff.ifds
20-
ifd = ifds[0]
21-
ifd.compression
22-
ifd.tile_height
23-
ifd.tile_width
24-
ifd.photometric_interpretation
25-
gkd = ifd.geo_key_directory
26-
gkd.citation
27-
gkd.projected_type
28-
gkd.citation
29-
30-
dir(gkd)
7+
async def test_cog_s3():
8+
"""
9+
Ensure that TIFF.open can open a Sentinel-2 Cloud-Optimized GeoTIFF file from an
10+
s3 bucket, read IFDs and GeoKeyDirectory metadata.
11+
"""
12+
path = "sentinel-s2-l2a-cogs/12/S/UF/2022/6/S2B_12SUF_20220609_0_L2A/B04.tif"
13+
store = S3Store("sentinel-cogs", region="us-west-2", skip_signature=True)
14+
tiff = await TIFF.open(path=path, store=store, prefetch=32768)
15+
16+
ifds = tiff.ifds
17+
assert len(ifds) == 5
18+
19+
ifd = ifds[0]
20+
assert ifd.compression == enums.CompressionMethod.Deflate
21+
assert ifd.tile_height == 1024
22+
assert ifd.tile_width == 1024
23+
assert ifd.photometric_interpretation == enums.PhotometricInterpretation.BlackIsZero
24+
25+
gkd = ifd.geo_key_directory
26+
assert gkd.citation == "WGS 84 / UTM zone 12N"
27+
assert gkd.projected_type == 32612
3128

3229

3330
async def test_cog_missing_file():

python/uv.lock

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)