[
https://issues.apache.org/jira/browse/BEAM-9146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17028911#comment-17028911
]
Kamil Wasilewski commented on BEAM-9146:
----------------------------------------
How do you create `self._mock_client`? If it's an instance of `MagicMock`, this
won't work here. However, you can build your mock as follows:
{code:python}
m = mock.Mock()
m2 = mock.Mock()
m2.result.return_value = None
m.annotate_video.return_value = m2
{code}
This will work (and it works for me), but there's another problem: it's
impossible to check `m.annotate_video.called`, because the mock is got replaced
by its copy. What I did, was using Metrics API instead. Just create a counter,
increment it by 1 inside your `annotate_video` function and check its value
after pipeline execution.
Hope this helps.
> [Python] PTransform that integrates Video Intelligence functionality
> --------------------------------------------------------------------
>
> Key: BEAM-9146
> URL: https://issues.apache.org/jira/browse/BEAM-9146
> Project: Beam
> Issue Type: Sub-task
> Components: io-py-gcp
> Reporter: Kamil Wasilewski
> Assignee: Kamil Wasilewski
> Priority: Major
>
> The goal is to create a PTransform that integrates Google Cloud Video
> Intelligence functionality [1].
> The transform should be able to take both video GCS location or video data
> bytes as an input.
> The transform should be put into _sdks/python/apache_beam/io/gcp/ai_ folder.
> [1] https://cloud.google.com/video-intelligence/
--
This message was sent by Atlassian Jira
(v8.3.4#803005)