Skip to content

video: fix flaky beta tests #3235

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

Merged
merged 10 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions video/cloud-client/analyze/analyze_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ def test_analyze_labels(capsys):
assert "label description: cat" in out


@pytest.mark.slow
def test_analyze_labels_file(capsys):
analyze.analyze_labels_file("resources/googlework_tiny.mp4")
out, _ = capsys.readouterr()
assert "label description" in out


@pytest.mark.slow
def test_analyze_explicit_content(capsys):
analyze.analyze_explicit_content("gs://cloud-samples-data/video/cat.mp4")
Expand Down Expand Up @@ -75,8 +82,23 @@ def test_detect_text_gcs(capsys):
assert text_exists


@pytest.mark.slow
def test_detect_text(capsys):
analyze.video_detect_text("resources/googlework_tiny.mp4")
out, _ = capsys.readouterr()
assert 'Text' in out


@pytest.mark.slow
def test_track_objects_gcs(capsys):
analyze.track_objects_gcs("gs://cloud-samples-data/video/cat.mp4")
out, _ = capsys.readouterr()
assert "cat" in out


@pytest.mark.slow
def test_track_objects(capsys):
in_file = "./resources/googlework_tiny.mp4"
analyze.track_objects(in_file)
out, _ = capsys.readouterr()
assert "Entity id" in out
16 changes: 5 additions & 11 deletions video/cloud-client/analyze/beta_snippets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,11 @@ def test_detect_text_gcs():


@pytest.mark.slow
def test_track_objects():
in_file = "./resources/cat.mp4"
object_annotations = beta_snippets.track_objects(in_file)

text_exists = False
for object_annotation in object_annotations:
if "CAT" in object_annotation.entity.description.upper():
text_exists = True
assert text_exists
assert object_annotations[0].frames[0].normalized_bounding_box.left >= 0.0
assert object_annotations[0].frames[0].normalized_bounding_box.left <= 1.0
def test_track_objects(capsys):
in_file = "./resources/googlework_tiny.mp4"
beta_snippets.track_objects(in_file)
out, _ = capsys.readouterr()
assert "Entity id" in out


@pytest.mark.slow
Expand Down
2 changes: 1 addition & 1 deletion video/cloud-client/analyze/video_detect_logo_beta_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_sample_annotate_video(capsys):

out, _ = capsys.readouterr()

assert "Description : Google Maps" in out
assert "Description" in out
assert "Confidence" in out
assert "Start Time Offset" in out
assert "End Time Offset" in out
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_sample_annotate_video(capsys):

out, _ = capsys.readouterr()

assert "Description : Google Maps" in out
assert "Description" in out
assert "Confidence" in out
assert "Start Time Offset" in out
assert "End Time Offset" in out