Skip to content

Add tests for is_vision_model() caching behaviour#4855

Merged
danielhanchen merged 4 commits into
mainfrom
tests/vision-cache-tests
Apr 6, 2026
Merged

Add tests for is_vision_model() caching behaviour#4855
danielhanchen merged 4 commits into
mainfrom
tests/vision-cache-tests

Conversation

@danielhanchen
Copy link
Copy Markdown
Member

Summary

Test plan

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a comprehensive test suite for the is_vision_model caching mechanism, covering cache hits, misses, subprocess paths, and token-based isolation. The review identifies an unused helper function _make_config that should be removed and suggests modifying test_exception_result_cached to raise an actual exception to properly verify the fallback logic.

Comment thread studio/backend/tests/test_vision_cache.py Outdated
Comment thread studio/backend/tests/test_vision_cache.py Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a25c064dea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread studio/backend/tests/test_vision_cache.py
Comment thread studio/backend/tests/test_vision_cache.py Outdated
- Remove unused _make_config() helper function (dead code)
- Fix test_exception_result_cached to actually exercise the exception path
  by mocking load_model_config to raise OSError instead of using
  side_effect=[False] which only tested normal False returns
@rolandtannous rolandtannous force-pushed the tests/vision-cache-tests branch from 8fb09c4 to 14d6731 Compare April 5, 2026 04:05
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 44f04582de

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread studio/backend/tests/test_vision_cache.py Outdated
Use MagicMock(spec=[]) for all config mocks so hasattr() only returns
True for explicitly set attributes. Without this, MagicMock defaults
make all hasattr checks truthy, allowing tests to pass via unintended
detection paths (e.g. img_processor instead of vision_config).
@Datta0
Copy link
Copy Markdown
Collaborator

Datta0 commented Apr 6, 2026

#4868
There seem to be some issues with VLM detection for models that need transformers v5
I made the PR to fix it

Refer: #4859

@danielhanchen danielhanchen merged commit ab65b47 into main Apr 6, 2026
5 checks passed
@danielhanchen danielhanchen deleted the tests/vision-cache-tests branch April 6, 2026 13:41
shibizhao pushed a commit to shibizhao/unsloth-npu that referenced this pull request Apr 7, 2026
* Add tests for is_vision_model() caching behaviour

* Fix review feedback: remove dead helper, fix exception test

- Remove unused _make_config() helper function (dead code)
- Fix test_exception_result_cached to actually exercise the exception path
  by mocking load_model_config to raise OSError instead of using
  side_effect=[False] which only tested normal False returns

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Use strict mock specs so tests exercise intended detection paths

Use MagicMock(spec=[]) for all config mocks so hasattr() only returns
True for explicitly set attributes. Without this, MagicMock defaults
make all hasattr checks truthy, allowing tests to pass via unintended
detection paths (e.g. img_processor instead of vision_config).

---------

Co-authored-by: Roland Tannous <rolandtannous@gravityq.ai>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants