Skip to content

[GH-2142] Fix STAC python unit tests for remote endpoint - #2143

Merged
jiayuasu merged 6 commits into
apache:masterfrom
zhangfengcdt:bugfix/flaky.stac.client.tests
Jul 23, 2025
Merged

jiayuasu merged 6 commits into
apache:masterfrom
zhangfengcdt:bugfix/flaky.stac.client.tests

Conversation

@zhangfengcdt

Copy link
Copy Markdown
Member

Did you read the Contributor Guide?

Is this PR related to a ticket?

  • Yes, and the PR name follows the format [GH-XXX] my subject. Closes #<issue_number>

What changes were proposed in this PR?

The current stac reader python API depends on the following external stac service endpoint:
https://planetarycomputer.microsoft.com/api/stac/v1

While the endpoint is generally reliable, sometimes it will return incorrect / inconsistent data that failed the test when count the items returned. In order to make the tests more reliable, we'd only test the api itself, but not check the data correctness returned from the external services.

How was this patch tested?

stac python tests

Did this PR include necessary documentation updates?

  • No, this PR does not affect any public API so no need to change the documentation.

@zhangfengcdt
zhangfengcdt marked this pull request as ready for review July 22, 2025 22:24
@zhangfengcdt
zhangfengcdt requested a review from jiayuasu as a code owner July 22, 2025 22:24
@zhangfengcdt
zhangfengcdt requested a review from Copilot July 22, 2025 22:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes flaky STAC Python unit tests by removing dependencies on external service data consistency. The changes focus on testing API functionality rather than validating specific data counts from the external Planetary Computer STAC endpoint, which can return inconsistent results.

  • Replaces specific count assertions with type checks to verify API returns expected object types
  • Removes data validation checks that depend on external service consistency
  • Updates documentation to support additional URL schemes for better testability

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
python/tests/stac/test_collection_client.py Replaces DataFrame count checks with type assertions and removes item count validations
python/tests/stac/test_client.py Changes item count checks to Iterator type assertions for search results
python/sedona/spark/stac/collection_client.py Updates URL handling documentation and logic to support local file paths

Comment thread python/tests/stac/test_client.py Resolved
zhangfengcdt and others added 4 commits July 22, 2025 15:35
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jiayuasu jiayuasu added this to the sedona-1.8.0 milestone Jul 23, 2025
@jiayuasu jiayuasu added the bug label Jul 23, 2025
@jiayuasu jiayuasu linked an issue Jul 23, 2025 that may be closed by this pull request
@jiayuasu
jiayuasu merged commit b42605c into apache:master Jul 23, 2025
Kontinuation pushed a commit to Kontinuation/sedona that referenced this pull request Jan 21, 2026
…e#2143)

* Fix STAC python unit tests for remote endpoint

* fix lint error

* Update python/tests/stac/test_collection_client.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update python/tests/stac/test_client.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* revert collection_client change

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

STAC reader unit tests on remote endponts fails for some runs on ci

3 participants