-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: Image utils optional dependency errors and unblock unit tests on minimal env #5808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
017a91a to
fc9bb71
Compare
There was a problem hiding this 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 fixes error handling in feast.image_utils when optional image dependencies are missing and enables unit tests to run in minimal environments without integration dependencies.
- Adds
_check_image_dependencies()calls tovalidate_image_formatandget_image_metadatato raise clearImportErrorwhen image dependencies are missing - Adds unit tests to verify optional dependency handling
- Updates test infrastructure to support running unit tests without optional integration/auth dependencies
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| sdk/python/feast/image_utils.py | Added dependency checks to image validation and metadata extraction functions |
| sdk/python/tests/unit/test_image_utils_optional_deps.py | New unit tests verifying ImportError behavior when image dependencies are unavailable |
| sdk/python/tests/conftest.py | Wrapped integration and auth test imports in try-except blocks to allow conftest loading without optional dependencies; fixed Windows platform detection |
| sdk/python/pytest.ini | Removed deprecated pytest configuration for pytest 8 compatibility |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
35db3ae to
d8fd430
Compare
Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com> Signed-off-by: Lanre Shittu <136805224+Shizoqua@users.noreply.github.com> Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com>
Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com> Signed-off-by: Lanre Shittu <136805224+Shizoqua@users.noreply.github.com> Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com>
Signed-off-by: Lanre Shittu <136805224+Shizoqua@users.noreply.github.com> Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com>
…s.py Signed-off-by: Lanre Shittu <136805224+Shizoqua@users.noreply.github.com> Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com>
Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com>
bdd4b82 to
2b2a4f2
Compare
Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com>
|
Good day @franciscojavierarceo |
|
Good day @franciscojavierarceo |
Signed-off-by: Shizoqua <hr.lanreshittu@yahoo.com>
|
Hello, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if not _integration_test_deps_available: | ||
| pytest.skip("Integration test dependencies are not available") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 pytest.skip() called during test collection causes collection error instead of graceful skip
Calling pytest.skip() inside pytest_generate_tests() at line 292 is incorrect and will cause a collection error rather than gracefully skipping the test.
Click to expand
Problem
pytest.skip() raises a Skipped exception that is designed to be caught by pytest's test runner during test execution, not during test collection. When called in pytest_generate_tests(), it will cause pytest to report a collection error.
Code path
When _integration_test_deps_available is False (dependencies not installed), the code reaches:
if not _integration_test_deps_available:
pytest.skip("Integration test dependencies are not available")This will raise pytest.skip.Exception which is not handled during collection, causing the test suite to error out instead of skipping the tests gracefully.
Proper fix
The correct approach would be to either:
- Return early and not parametrize the test (which may cause fixture errors)
- Use
metafunc.parametrize()with an empty list and mark withpytest.mark.skip - Use
pytest.skip(allow_module_level=True)at module level beforepytest_generate_testsis called
Impact
When running tests without integration dependencies installed, the test collection will fail with an error instead of gracefully skipping the affected tests.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
This PR fixes behavior in
feast.image_utilswhen optional image dependencies are not installed, and adds unit tests to cover the expected failure mode.While validating the fix locally, I also addressed a few test-harness issues that prevented running unit tests in a minimal environment (without integration/auth optional deps).
Changes
ImportErrorwhenfeast[image]deps are missing (instead of failing with aNameErrordue to missingPIL.Image).env=config that requires extra plugins.sys.platformiswin32, notwindows).Why
feast[image]dependencies are not installed.Test Plan
python -m pytest -q tests/unit/test_image_utils_optional_deps.py