Skip to content

Commit 83394e1

Browse files
Takashi Matsuodanoscarmike
Takashi Matsuo
authored andcommitted
[video] testing: mark some tests witih flaky [(#3446)](GoogleCloudPlatform/python-docs-samples#3446)
fixes #3275
1 parent 13554d6 commit 83394e1

8 files changed

+32
-12
lines changed

packages/google-cloud-videointelligence/samples/analyze/analyze_test.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
# limitations under the License.
1616

1717
import pytest
18-
from flaky import flaky
1918

2019
import analyze
2120

@@ -71,29 +70,31 @@ def test_speech_transcription(capsys):
7170

7271

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

8079

8180
# Flaky timeout
82-
@flaky(max_runs=3, min_passes=1)
81+
@pytest.mark.flaky(max_runs=3, min_passes=1)
8382
def test_detect_text(capsys):
8483
analyze.video_detect_text("resources/googlework_tiny.mp4")
8584
out, _ = capsys.readouterr()
8685
assert 'Text' in out
8786

8887

89-
@pytest.mark.slow
88+
# Flaky timeout
89+
@pytest.mark.flaky(max_runs=3, min_passes=1)
9090
def test_track_objects_gcs(capsys):
9191
analyze.track_objects_gcs("gs://cloud-samples-data/video/cat.mp4")
9292
out, _ = capsys.readouterr()
9393
assert "cat" in out
9494

9595

96-
@pytest.mark.slow
96+
# Flaky timeout
97+
@pytest.mark.flaky(max_runs=3, min_passes=1)
9798
def test_track_objects(capsys):
9899
in_file = "./resources/googlework_tiny.mp4"
99100
analyze.track_objects(in_file)

packages/google-cloud-videointelligence/samples/analyze/beta_snippets_test.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@
1818
import os
1919
import uuid
2020

21-
import beta_snippets
2221
from google.cloud import storage
2322
import pytest
24-
from flaky import flaky
2523

24+
import beta_snippets
2625

2726
POSSIBLE_TEXTS = [
2827
"Google",
@@ -114,7 +113,7 @@ def test_annotation_to_storage_streaming(capsys, video_path, bucket):
114113

115114

116115
# Flaky timeout
117-
@flaky(max_runs=3, min_passes=1)
116+
@pytest.mark.flaky(max_runs=3, min_passes=1)
118117
def test_detect_text(capsys):
119118
in_file = "./resources/googlework_tiny.mp4"
120119
beta_snippets.video_detect_text(in_file)
@@ -123,15 +122,15 @@ def test_detect_text(capsys):
123122

124123

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

133-
134-
@pytest.mark.slow
132+
# Flaky InvalidArgument
133+
@pytest.mark.flaky(max_runs=3, min_passes=1)
135134
def test_track_objects(capsys):
136135
in_file = "./resources/googlework_tiny.mp4"
137136
beta_snippets.track_objects(in_file)
@@ -154,7 +153,7 @@ def test_track_objects_gcs():
154153

155154

156155
# Flaky Gateway
157-
@flaky(max_runs=3, min_passes=1)
156+
@pytest.mark.flaky(max_runs=3, min_passes=1)
158157
def test_streaming_automl_classification(capsys, video_path):
159158
project_id = os.environ["GCLOUD_PROJECT"]
160159
model_id = "VCN6363999689846554624"

packages/google-cloud-videointelligence/samples/analyze/video_detect_faces_beta_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@
1414

1515
import os
1616

17+
import pytest
18+
1719
import video_detect_faces_beta
1820

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

2123

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

packages/google-cloud-videointelligence/samples/analyze/video_detect_faces_gcs_beta_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@
1414

1515
import os
1616

17+
import pytest
18+
1719
import video_detect_faces_gcs_beta
1820

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

2123

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

packages/google-cloud-videointelligence/samples/analyze/video_detect_logo_gcs_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@
1414

1515
import os
1616

17+
import pytest
18+
1719
import video_detect_logo_gcs
1820

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

2123

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

packages/google-cloud-videointelligence/samples/analyze/video_detect_logo_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@
1414

1515
import os
1616

17+
import pytest
18+
1719
import video_detect_logo
1820

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

2123

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

packages/google-cloud-videointelligence/samples/analyze/video_detect_person_beta_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@
1414

1515
import os
1616

17+
import pytest
18+
1719
import video_detect_person_beta
1820

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

2123

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

packages/google-cloud-videointelligence/samples/analyze/video_detect_person_gcs_beta_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@
1414

1515
import os
1616

17+
import pytest
18+
1719
import video_detect_person_gcs_beta
1820

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

2123

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

0 commit comments

Comments
 (0)