Skip to content

Conversation

zhangfengcdt
Copy link
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?

This PR refactors the STAC tests to use mock clients instead of real external STAC servers, making the tests more reliable and faster.

  • Added test_mock_fixtures.py with mock implementations of STAC Client and CollectionClient
  • Refactored test_client.py to use @patch decorators with mock clients
  • Refactored test_collection_client.py to use @patch decorators with mock clients

How was this patch tested?

  • All 34 STAC tests now use mocked responses instead of external servers

Did this PR include necessary documentation updates?

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

Copy link
Contributor

@Copilot Copilot AI left a comment

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 refactors STAC tests to use mock clients instead of real external STAC servers, making the tests more reliable and resilient to network failures. The change improves test stability by eliminating dependencies on external services.

  • Created mock implementations of STAC Client and CollectionClient
  • Refactored all STAC tests to use @patch decorators with mock clients
  • Replaced external server calls with predictable mock responses

Reviewed Changes

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

File Description
python/tests/stac/test_mock_fixtures.py Introduces mock classes for STAC Client, CollectionClient, and related fixtures
python/tests/stac/test_collection_client.py Updates all CollectionClient tests to use mocked clients instead of external servers
python/tests/stac/test_client.py Updates all Client tests to use mocked clients instead of external servers

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@jiayuasu
Copy link
Member

jiayuasu commented Sep 15, 2025

The Scala and Java tests also suffer from the same issue. Do you plan to solve them too?

If you plan to solve them in another PR, that's fine too!

@zhangfengcdt
Copy link
Member Author

The Scala and Java tests also suffer from the same issue. Do you plan to solve them too?

If you plan to solve them in another PR, that's fine too!

Yes, I will create another PR to address scala / java tests.

@jiayuasu jiayuasu merged commit 4ac1e48 into apache:master Sep 15, 2025
31 checks passed
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.

2 participants