urllib request mocking for pystac/load_stac related tests?
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, ...)
There's openeo_driver.testing.UrllibMocker and tests.conftest.UrllibPoolManagerMocker in openeo-geopyspark-driver.
indeed, but instead of these somewhat brittle DIY hacks I'm hoping to find some some 3rd party solution that is more standard/official/feature-rich
Yeah, they have shortcomings as well.