Skip to content
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

Make GIS models testable and test in CI #171

Merged
merged 6 commits into from
Aug 25, 2024
Merged

Conversation

EwoutH
Copy link
Member

@EwoutH EwoutH commented Aug 25, 2024

This PR enables testing all GIS models with pytest, just like we do with our regular models (see #65 and #82). This includes a new test_gis_examples.py that allows running the tests locally, and is also used in the CI.

image

Checklist

  • Use relative imports in all models. This way models can be ran from different locations, which will help with testing them.
  • Clean up and modernize current CI
  • Define GIS dependencies as optional set in pyproject.toml
  • Add CI configurations that runs on .py file changes in gis folder

Currently a lot of the example models still fail on various issues with the specific model. Help is very much wanted!

EwoutH and others added 3 commits August 25, 2024 16:10
Use relative imports in all models. This way models can be ran from different locations, which will help with testing them.
- Rename workflow
- Run on each push (which allows developing on test branches in this repo)
- Run only on changes to the example models, the test script or the CI config
- Allow multiple commits after each other (to allow continuous trial and error
@EwoutH
Copy link
Member Author

EwoutH commented Aug 25, 2024

PR is ready for review, all the CI and test code works as intended.

Some model example tests fail, and I will fix the most obvious ones, but all others can be fixed in separate PRs.

@EwoutH EwoutH marked this pull request as ready for review August 25, 2024 14:34
@EwoutH EwoutH requested review from rht, wang-boyu and tpike3 August 25, 2024 14:35
@@ -48,7 +40,7 @@ jobs:
- name: Install dependencies
run: |
pip install mesa --pre
pip install pytest
pip install .[test]
Copy link
Contributor

Choose a reason for hiding this comment

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

Reminder to use uv later in a separate PR.

- cron: '0 6 * * 1' # Monday at 6:00 UTC

jobs:
# build-stable:
Copy link
Contributor

Choose a reason for hiding this comment

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

When will this be enabled?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. I think we will want to make a backport to the mesa-2.x branch with examples, since Mesa-Geo is meant to work with Mesa 2.3.

So then we will make te split of testing pre-releases + git on the main branch, and stable on the Mesa-Geo 0.8.x branch.

@EwoutH EwoutH merged commit 49342ea into projectmesa:main Aug 25, 2024
5 of 9 checks passed
@EwoutH EwoutH deleted the gis_tests branch August 25, 2024 15:04
@EwoutH EwoutH mentioned this pull request Aug 25, 2024
31 tasks
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