-
Notifications
You must be signed in to change notification settings - Fork 2
Enable pytest-asyncio tests in CI #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
bfce9ac
695bc5f
bfb3a43
d0f98ac
b08fe51
28973b9
12b230f
638d602
3be22b7
ca31048
773fad8
aa21368
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,8 +67,8 @@ jobs: | |
|
||
- name: maturin venv Build | ||
working-directory: python | ||
run: uv run --no-project maturin develop | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I though if the working directory is set to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not the cargo project that's the issue. It's the uv project. We don't want uv automatically building the rust parts of async-tiff in release mode. |
||
run: uv run maturin develop | ||
|
||
# - name: Run pytest | ||
# working-directory: python | ||
# run: uv run --no-project pytest | ||
- name: Run pytest | ||
working-directory: python | ||
run: uv run pytest --verbose |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
import async_tiff | ||
from time import time | ||
from async_tiff import TIFF | ||
|
||
from async_tiff import TIFF, enums | ||
from async_tiff.store import S3Store | ||
|
||
store = S3Store("sentinel-cogs", region="us-west-2", skip_signature=True) | ||
path = "sentinel-s2-l2a-cogs/12/S/UF/2022/6/S2B_12SUF_20220609_0_L2A/B04.tif" | ||
|
||
tiff = await TIFF.open(path, store=store, prefetch=32768) | ||
async def test_cog_s3(): | ||
""" | ||
Ensure that TIFF.open can open a Sentinel-2 Cloud-Optimized GeoTIFF file from an | ||
s3 bucket, read IFDs and GeoKeyDirectory metadata. | ||
""" | ||
store = S3Store("sentinel-cogs", region="us-west-2", skip_signature=True) | ||
path = "sentinel-s2-l2a-cogs/12/S/UF/2022/6/S2B_12SUF_20220609_0_L2A/B04.tif" | ||
|
||
start = time() | ||
tiff = await TIFF.open(path=path, store=store, prefetch=32768) | ||
end = time() | ||
assert end - start < 5 # take less than 5 seconds to open | ||
weiji14 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
start = time() | ||
tiff = await TIFF.open(path, store=store, prefetch=32768) | ||
end = time() | ||
end - start | ||
ifds = tiff.ifds | ||
assert len(ifds) == 5 | ||
|
||
ifds = tiff.ifds | ||
ifd = ifds[0] | ||
ifd.compression | ||
ifd.tile_height | ||
ifd.tile_width | ||
ifd.photometric_interpretation | ||
gkd = ifd.geo_key_directory | ||
gkd.citation | ||
gkd.projected_type | ||
gkd.citation | ||
ifd = ifds[0] | ||
assert ifd.compression == enums.CompressionMethod.Deflate | ||
assert ifd.tile_height == 1024 | ||
assert ifd.tile_width == 1024 | ||
assert ifd.photometric_interpretation == enums.PhotometricInterpretation.BlackIsZero | ||
|
||
dir(gkd) | ||
gkd = ifd.geo_key_directory | ||
assert gkd.citation == "WGS 84 / UTM zone 12N" | ||
assert gkd.projected_type == 32612 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like the line above this is incorrect
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean
uv sync --no-install-package geoindex-rs
should be justuv sync
?Edit: Just removed the entire
uv sync ...
line at commit 638d602, and it seems to run fine.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, it needs to be
uv sync --no-install-package async-tiff
. And then the lines after that still need the--no-project
.You see this line: https://github.com/developmentseed/async-tiff/actions/runs/14786441598/job/41515604193#step:7:19
When you run
uv sync
it builds the rust code in release mode as part of the current project. For fastest CI we want to build and test in debug mode, not release mode. That means we want to telluv
not to automatically buildasync-tiff
, because we'll manually build it after withmaturin develop
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I think you're right. Checking the timings:
uv sync
= 2m0suv run maturin develop
= 46suv run maturin develop
= 2m54sSo let's do
uv sync --no-install-package async-tiff
&&uv run --no-project maturin develop
.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final timings at commit aa21368, job https://github.com/developmentseed/async-tiff/actions/runs/14825301405/job/41617636468:
uv sync --no-install-package async-tiff
= 3suv run --no-project maturin develop
= 46s