Skip to content
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

RSDK-5174: Fix get_image mimetype handler in python sdk #446

Merged
merged 2 commits into from
Sep 28, 2023

Conversation

hexbabe
Copy link
Member

@hexbabe hexbabe commented Sep 27, 2023

https://viam.atlassian.net/browse/RSDK-5174

The first conditional branch of get_image_from_response never gets hit because the default mime_type value in the invoker— get_image in client.py — is "" and not None.

@hexbabe hexbabe marked this pull request as ready for review September 27, 2023 17:38
@hexbabe hexbabe requested a review from a team as a code owner September 27, 2023 17:39
Copy link
Member

@cheukt cheukt left a comment

Choose a reason for hiding this comment

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

is there a corresponding test we can add?

@hexbabe
Copy link
Member Author

hexbabe commented Sep 28, 2023

is there a corresponding test we can add?

I think a test exists for this use case i.e. empty mime type, but we don't invoke the helper function, get_image_from_response, that actually handles the logic. We do it manually like this:

            # Test empty mime type. Empty mime type should default to JPEG for non-depth cameras
            request = GetImageRequest(name="camera")
            response: GetImageResponse = await client.GetImage(request)
            assert service._camera_mime_types["camera"] == CameraMimeType.JPEG

@hexbabe
Copy link
Member Author

hexbabe commented Sep 28, 2023

I also tested with an actual Python sdk client and it works now no args

Copy link
Member

@seanavery seanavery left a comment

Choose a reason for hiding this comment

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

LGTM!

@hexbabe hexbabe merged commit eaec616 into viamrobotics:main Sep 28, 2023
5 checks passed
@hexbabe hexbabe deleted the RSDK-5174 branch September 28, 2023 17:51
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.

4 participants