Skip to content

Commit

Permalink
[video] testing: mark some tests witih flaky [(#3446)](#3446)
Browse files Browse the repository at this point in the history
fixes #3275
  • Loading branch information
Takashi Matsuo authored and danoscarmike committed Sep 30, 2020
1 parent dff7ccc commit ada70ec
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 12 deletions.
11 changes: 6 additions & 5 deletions videointelligence/samples/analyze/analyze_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# limitations under the License.

import pytest
from flaky import flaky

import analyze

Expand Down Expand Up @@ -71,29 +70,31 @@ def test_speech_transcription(capsys):


# Flaky timeout
@flaky(max_runs=3, min_passes=1)
@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_detect_text_gcs(capsys):
analyze.video_detect_text_gcs("gs://cloud-samples-data/video/googlework_tiny.mp4")
out, _ = capsys.readouterr()
assert 'Text' in out


# Flaky timeout
@flaky(max_runs=3, min_passes=1)
@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_detect_text(capsys):
analyze.video_detect_text("resources/googlework_tiny.mp4")
out, _ = capsys.readouterr()
assert 'Text' in out


@pytest.mark.slow
# Flaky timeout
@pytest.mark.flaky(max_runs=3, min_passes=1)
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
# Flaky timeout
@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_track_objects(capsys):
in_file = "./resources/googlework_tiny.mp4"
analyze.track_objects(in_file)
Expand Down
13 changes: 6 additions & 7 deletions videointelligence/samples/analyze/beta_snippets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
import os
import uuid

import beta_snippets
from google.cloud import storage
import pytest
from flaky import flaky

import beta_snippets

POSSIBLE_TEXTS = [
"Google",
Expand Down Expand Up @@ -114,7 +113,7 @@ def test_annotation_to_storage_streaming(capsys, video_path, bucket):


# Flaky timeout
@flaky(max_runs=3, min_passes=1)
@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_detect_text(capsys):
in_file = "./resources/googlework_tiny.mp4"
beta_snippets.video_detect_text(in_file)
Expand All @@ -123,15 +122,15 @@ def test_detect_text(capsys):


# Flaky timeout
@flaky(max_runs=3, min_passes=1)
@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_detect_text_gcs(capsys):
in_file = "gs://python-docs-samples-tests/video/googlework_tiny.mp4"
beta_snippets.video_detect_text_gcs(in_file)
out, _ = capsys.readouterr()
assert 'Text' in out


@pytest.mark.slow
# Flaky InvalidArgument
@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_track_objects(capsys):
in_file = "./resources/googlework_tiny.mp4"
beta_snippets.track_objects(in_file)
Expand All @@ -154,7 +153,7 @@ def test_track_objects_gcs():


# Flaky Gateway
@flaky(max_runs=3, min_passes=1)
@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_streaming_automl_classification(capsys, video_path):
project_id = os.environ["GCLOUD_PROJECT"]
model_id = "VCN6363999689846554624"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@

import os

import pytest

import video_detect_faces_beta

RESOURCES = os.path.join(os.path.dirname(__file__), "resources")


@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_detect_faces(capsys):
local_file_path = os.path.join(RESOURCES, "googlework_short.mp4")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@

import os

import pytest

import video_detect_faces_gcs_beta

RESOURCES = os.path.join(os.path.dirname(__file__), "resources")


@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_detect_faces(capsys):
input_uri = "gs://cloud-samples-data/video/googlework_short.mp4"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@

import os

import pytest

import video_detect_logo_gcs

RESOURCES = os.path.join(os.path.dirname(__file__), "resources")


# Flaky Deadline
@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_detect_logo_gcs(capsys):
input_uri = "gs://cloud-samples-data/video/googlework_tiny.mp4"

Expand Down
4 changes: 4 additions & 0 deletions videointelligence/samples/analyze/video_detect_logo_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@

import os

import pytest

import video_detect_logo

RESOURCES = os.path.join(os.path.dirname(__file__), "resources")


# Flaky Bad Gateway
@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_detect_logo(capsys):
local_file_path = os.path.join(RESOURCES, "googlework_tiny.mp4")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@

import os

import pytest

import video_detect_person_beta

RESOURCES = os.path.join(os.path.dirname(__file__), "resources")


@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_detect_person(capsys):
local_file_path = os.path.join(RESOURCES, "googlework_tiny.mp4")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@

import os

import pytest

import video_detect_person_gcs_beta

RESOURCES = os.path.join(os.path.dirname(__file__), "resources")


@pytest.mark.flaky(max_runs=3, min_passes=1)
def test_detect_person(capsys):
input_uri = "gs://cloud-samples-data/video/googlework_tiny.mp4"

Expand Down

0 comments on commit ada70ec

Please sign in to comment.