Skip to content

Add spatialindex version to tests, add common pytest configuration#360

Merged
mwtoews merged 4 commits intoToblerity:mainfrom
mwtoews:refactor-tests
Mar 24, 2025
Merged

Add spatialindex version to tests, add common pytest configuration#360
mwtoews merged 4 commits intoToblerity:mainfrom
mwtoews:refactor-tests

Conversation

@mwtoews
Copy link
Copy Markdown
Member

@mwtoews mwtoews commented Mar 24, 2025

This adds a common module for the tests, for items that aren't fixtures. So far it gets the libspatialindex version string and tuple.

Also establish a pytest configuration.

@mwtoews mwtoews added this to the 1.4.1 milestone Mar 24, 2025
@adamjstewart
Copy link
Copy Markdown
Collaborator

Wouldn't it make more sense to define this as a reusable fixture in a conftest.py file? https://docs.pytest.org/en/stable/reference/fixtures.html#conftest-py-sharing-fixtures-across-multiple-files

@mwtoews
Copy link
Copy Markdown
Member Author

mwtoews commented Mar 24, 2025

Aren't fixtures specific to running pytests? I.e., shouldn't sidx_version be just a regular variable? I generally keep conftest.py only for fixtures, not other variables.

Also, it seems that I don't know how to stop deploy from always running, despite adding a "paths" filter for pull_requests.

@adamjstewart
Copy link
Copy Markdown
Collaborator

Yes, fixtures are only compatible with pytest, not unittest. They can be used for anything that needs to be repeated in multiple places.

For deploy, I think the change will only go into effect once it is merged, you can't enable/disable workflows on PRs.

@mwtoews
Copy link
Copy Markdown
Member Author

mwtoews commented Mar 24, 2025

I can't see an easy way to leverage fixtures as simple variables (since fixtures are special functions), so will proceed with a simple approach in tests for now.

For 1.5.x, both sidx_version_string and sidx_version cam be moved to the main module, as these could be handy for users too.

Just noticed that the conda tests were always excluding macos and SIDX 1.8.5, which is fixed to cover these.

@mwtoews mwtoews merged commit a868dba into Toblerity:main Mar 24, 2025
23 checks passed
@mwtoews mwtoews deleted the refactor-tests branch March 24, 2025 20:32
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