Open-EO / Open-EO/openeo-python-client
urllib request mocking for pystac/load_stac related tests?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 217
- Forks
- 56
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 2
Description
The openEO python client uses the popular requests module for HTTP requests. Testing of that is currently done with the requests_mock module.
For STAC support (e.g. load_stac) we are depending more and more on pystac which uses urllib/urllib3 internally. This is obviously not covered by requests_mock so we need something else as urllib mock utility. I might have missed something obvious but didn't find anything up to date yet
Because of lack of real URL mocking for urrlib, we currently workaround that with local paths to temp files, which is accepted by pystac. e.g.:
https://github.com/Open-EO/openeo-python-client/blob/026881df787de007205e110f765260aeaf2e9876/tests/rest/test_connection.py#L2950-L2957
That works for simple use cases, but it hinders testings of real HTTP functionality (e.g. handling of failed requests, handling relative URLs, ...)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tests/rest/test_connection.py around lines 2950-2957 and review how temporary local paths currently stand in for HTTP resources. Investigate an up-to-date way to mock urllib/urllib3 requests used by pystac, then cover failed requests and relative URLs so real HTTP behavior can be tested without local files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100