10000 Enable pytest-asyncio tests in CI by weiji14 · Pull Request #92 · developmentseed/async-tiff · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 12 commits into from
May 6, 2025
Merged

Enable pytest-asyncio tests in CI #92

merged 12 commits into from
May 6, 2025

Conversation

weiji14
Copy link
Member
@weiji14 weiji14 commented May 1, 2025

What I am changing

  • Setup pytest-asyncio properly on GitHub Actions CI to run python unit tests.

How I did it

How you can test it

  • Run cd python/ && uv run pytest --verbose locally, or check the CI logs.

Related Issues

@weiji14 weiji14 marked this pull request as ready for review May 1, 2025 04:21
@@ -67,8 +67,8 @@ jobs:

Copy link
Member

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

Copy link
Member Author
@weiji14 weiji14 May 1, 2025

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 just uv sync?

Edit: Just removed the entire uv sync ... line at commit 638d602, and it seems to run fine.

Copy link
Member

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 tell uv not to automatically build async-tiff, because we'll manually build it after with maturin develop

Copy link
Member Author
@weiji14 weiji14 May 4, 2025

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:

So let's do uv sync --no-install-package async-tiff && uv run --no-project maturin develop.

Copy link
Member Author
@weiji14 weiji14 May 4, 2025

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 = 3s
  • uv run --no-project maturin develop = 46s
  • Total: 49s 🚀

@@ -67,8 +67,8 @@ jobs:

- name: maturin venv Build
working-directory: python
run: uv run --no-project maturin develop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --no-project was here because I thought whenever we ran uv sync or uv run, uv would automatically build the current project, which would compile the rust code and take a while.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I though if the working directory is set to python/ already, then it should only compile what's inside the python/ folder? Don't we need to compile the rust code anyway before compiling the pyo3 code? A little confused here.

Copy link
Member

Choose a reason for hiding this comment

The 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.

with:
enable-cache: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume enable-cache is true by default in the latest setup-uv?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, default was changed to enable-cache: true since setup-uv v5, see https://github.com/astral-sh/setup-uv/releases/tag/v5.0.0

Copy link
Member
@kylebarron kylebarron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@kylebarron kylebarron merged commit 5daebd9 into main May 6, 2025
6 checks passed
@kylebarron kylebarron deleted the ci/pytest-asyncio branch May 6, 2025 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0