Standardize test image fixture loading for COCO images
Author: tarekziade
Pull request: no

### Problem

Several tests still download COCO fixture images directly with `httpx.get(...)` or `requests.get(...)`. This bypasses `utils/fetch_hub_objects_for_ci.py` and the existing `url_to_local_path(...)` fallback behavior, so CI prefetching can succeed while local or partial test runs still hit `http://images.cocodataset.org/...` directly.

We should have one test helper for loading image fixtures from URLs, and use it instead of open-coded `httpx` / `requests` calls in tests.

### Proposed change

Add a small helper in the shared test utilities, likely next to `url_to_local_path` in `tests/test_processing_common.py`, for example:

```python
def load_test_image(url: str):
    return load_image(url_to_local_path(url))
```

Then update tests that currently do this:

```python
Image.open(io.BytesIO(httpx.get(url, follow_redirects=True).content))
Image.open(requests.get(url, stream=True).raw)
```

to use the shared helper:

```python
image = load_test_image(url)
```

For COCO fixtures, the URLs should point at the Hub mirror under `hf-internal-testing/fixtures-coco`, not the original `images.cocodataset.org` host. The matching entries in `utils/fetch_hub_objects_for_ci.py` should also stay aligned with whatever URLs the tests use.

### Direct `httpx.get` / `requests.get` COCO call sites to update

`httpx.get(...)`:

- `tests/test_image_processing_common.py:180`
- `tests/models/vitpose/test_image_processing_vitpose.py:238`
- `tests/models/flava/test_image_processing_flava.py:409`
- `tests/models/pix2struct/test_image_processing_pix2struct.py:109`
- `tests/models/deepseek_vl_hybrid/test_image_processing_deepseek_vl_hybrid.py:212`
- `tests/models/kimi_k25/test_image_processing_kimi_k25.py:272`
- `tests/models/idefics/test_image_processing_idefics.py:156`
- `tests/models/fuyu/test_image_processing_fuyu.py:185`
- `tests/models/qwen2_vl/test_image_processing_qwen2_vl.py:299`

`requests.get(...)`:

- `tests/models/aimv2/test_modeling_aimv2.py:482`
- `tests/models/aimv2/test_modeling_aimv2.py:516`
- `tests/models/aimv2/test_modeling_aimv2.py:547`
- `tests/models/video_llama_3/test_image_processing_video_llama_3.py:300`
- `tests/models/eomt/test_modeling_eomt.py:178`
- `tests/models/eomt/test_modeling_eomt.py:221`
- `tests/models/eomt/test_modeling_eomt.py:237`
- `tests/models/eomt/test_modeling_eomt.py:274`
- `tests/models/eomt/test_modeling_eomt.py:323`
- `tests/models/eomt/test_modeling_eomt.py:369`
- `tests/models/eomt_dinov3/test_modeling_eomt_dinov3.py:223`
- `tests/models/eomt_dinov3/test_modeling_eomt_dinov3.py:265`
- `tests/models/eomt_dinov3/test_modeling_eomt_dinov3.py:322`
- `tests/models/eomt_dinov3/test_modeling_eomt_dinov3.py:378`
- `tests/models/eomt_dinov3/test_modeling_eomt_dinov3.py:424`
- `tests/models/eomt_dinov3/test_modeling_eomt_dinov3.py:466`
- `tests/models/minimax_m3_vl/test_modeling_minimax_m3_vl.py:700`
- `tests/models/layoutlmv2/test_image_processing_layoutlmv2.py:152`
- `tests/models/lfm2_vl/test_modeling_lfm2_vl.py:214`
- `tests/models/lfm2_vl/test_modeling_lfm2_vl.py:300`
- `tests/models/aria/test_modeling_aria.py:324`
- `tests/models/aria/test_modeling_aria.py:362`
- `tests/models/aria/test_modeling_aria.py:402`
- `tests/models/imagegpt/test_image_processing_imagegpt.py:289`
- `tests/models/llava/test_modeling_llava.py:370`
- `tests/models/llava/test_modeling_llava.py:421`
- `tests/models/llava/test_modeling_llava.py:474`
- `tests/models/fast_vlm/test_modeling_fast_vlm.py:285`

### Follow-up scope

There are more COCO URL literals in pipeline tests and model tests that are passed directly to pipelines/processors rather than downloaded with `httpx` or `requests`. Those can be handled separately by standardizing URL constants and wrapping them with `url_to_local_path(...)` where the test accepts local paths.


Comments:
Hi! I'd be interested in working on this issue if it's available.

I took a look at the current implementation and had one clarification before getting started. The issue mentions adding a shared helper "likely next to `url_to_local_path` in `tests/test_processing_common.py`", but `url_to_local_path` itself is defined in `utils/fetch_hub_objects_for_ci.py` and imported into the tests.
Would you prefer introducing `load_test_image()` alongside `url_to_local_path` in `utils/fetch_hub_objects_for_ci.py`, or defining it in `tests/test_processing_common.py` as a test-specific helper?
Also, should this PR be limited to replacing the listed `httpx.get`/`requests.get` call sites, leaving the additional URL literal cleanup mentioned under the follow-up scope for a separate PR?

If that aligns with the intended scope, I'd be happy to work on it.

Hi @LevelVoid that's great thanks!

I would  extend `tests/test_processing_common.py` for a test-specific helper since `utils/fetch_hub_objects_for_ci.py` is CI specific.

as for other occurences of URLs in an ideal word, we should have all of them in https://huggingface.co/datasets/hf-internal-testing/fixtures-coco or another dataset there so we don't depend on external websites even for prefetches.

some of those COCO URLs are already there and we might want to extend it. Happy to do that part if you'd like to work on this patch in paralel


Thanks for the clarification! That makes sense. I'll implement the test helper in `tests/test_processing_common.py` and limit this PR to the helper plus refactoring the listed `httpx.get`/`requests.get` call sites. Thanks for handling the fixture dataset updates in parallel.