Skip to content

Commit

Permalink
[datalabeling] testing: mark some tests as flaky
Browse files Browse the repository at this point in the history
  • Loading branch information
Takashi Matsuo committed Apr 20, 2020
1 parent 8ea9cf4 commit e8c0db8
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 20 deletions.
7 changes: 4 additions & 3 deletions datalabeling/create_annotation_spec_set_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@

import os

import create_annotation_spec_set
from google.cloud import datalabeling_v1beta1 as datalabeling
from google.api_core.client_options import ClientOptions
from google.cloud import datalabeling_v1beta1 as datalabeling
import pytest

import create_annotation_spec_set

PROJECT_ID = os.getenv('GCLOUD_PROJECT')


@pytest.mark.slow
@pytest.mark.flaky(max_runs=3)
def test_create_annotation_spec_set(capsys):
response = create_annotation_spec_set.create_annotation_spec_set(
PROJECT_ID)
Expand Down
1 change: 1 addition & 0 deletions datalabeling/create_instruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import argparse
import os

from google.api_core.client_options import ClientOptions


Expand Down
5 changes: 3 additions & 2 deletions datalabeling/create_instruction_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@

import os

import create_instruction
from google.api_core.client_options import ClientOptions
from google.cloud import datalabeling_v1beta1 as datalabeling
import pytest

import create_instruction

PROJECT_ID = os.getenv('GCLOUD_PROJECT')
INSTRUCTION_GCS_URI = ('gs://cloud-samples-data/datalabeling'
'/instruction/test.pdf')


@pytest.mark.slow
@pytest.mark.flaky(max_runs=3)
def test_create_instruction(capsys):
result = create_instruction.create_instruction(
PROJECT_ID,
Expand Down
5 changes: 3 additions & 2 deletions datalabeling/import_data_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@

import os

import pytest

import import_data
import manage_dataset
import pytest

PROJECT_ID = os.getenv('GCLOUD_PROJECT')
INPUT_GCS_URI = 'gs://cloud-samples-data/datalabeling/image/image_dataset.csv'
Expand All @@ -35,7 +36,7 @@ def dataset():
manage_dataset.delete_dataset(dataset.name)


@pytest.mark.slow
@pytest.mark.flaky(max_runs=3)
def test_import_data(capsys, dataset):
import_data.import_data(dataset.name, 'IMAGE', INPUT_GCS_URI)
out, _ = capsys.readouterr()
Expand Down
9 changes: 5 additions & 4 deletions datalabeling/label_image_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@

import os

import create_annotation_spec_set
import create_instruction
from google.api_core.client_options import ClientOptions
from google.cloud import datalabeling_v1beta1 as datalabeling
import pytest

import create_annotation_spec_set
import create_instruction
import import_data
import label_image
import manage_dataset
import pytest

PROJECT_ID = os.getenv('GCLOUD_PROJECT')
INPUT_GCS_URI = 'gs://cloud-samples-data/datalabeling/image/image_dataset.csv'
Expand Down Expand Up @@ -86,7 +87,7 @@ def instruction():

# Passing in dataset as the last argument in test_label_image since it needs
# to be deleted before the annotation_spec_set can be deleted.
@pytest.mark.slow
@pytest.mark.flaky(max_runs=3)
def test_label_image(capsys, annotation_spec_set, instruction, dataset):

# Start labeling.
Expand Down
9 changes: 5 additions & 4 deletions datalabeling/label_text_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@

import os

from google.api_core.client_options import ClientOptions
from google.cloud import datalabeling_v1beta1 as datalabeling
import pytest

import create_annotation_spec_set
import create_instruction
from google.cloud import datalabeling_v1beta1 as datalabeling
from google.api_core.client_options import ClientOptions
import import_data
import label_text
import manage_dataset
import pytest

PROJECT_ID = os.getenv('GCLOUD_PROJECT')
INPUT_GCS_URI = 'gs://cloud-samples-data/datalabeling/text/input.csv'
Expand Down Expand Up @@ -86,7 +87,7 @@ def instruction():

# Passing in dataset as the last argument in test_label_image since it needs
# to be deleted before the annotation_spec_set can be deleted.
@pytest.mark.slow
@pytest.mark.flaky(max_runs=3)
def test_label_text(capsys, annotation_spec_set, instruction, dataset):

# Start labeling.
Expand Down
9 changes: 5 additions & 4 deletions datalabeling/label_video_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@

import os

import create_annotation_spec_set
import create_instruction
from google.api_core.client_options import ClientOptions
from google.cloud import datalabeling_v1beta1 as datalabeling
import pytest

import create_annotation_spec_set
import create_instruction
import import_data
import label_video
import manage_dataset
import pytest

PROJECT_ID = os.getenv('GCLOUD_PROJECT')
INPUT_GCS_URI = 'gs://cloud-samples-data/datalabeling/videos/video_dataset.csv'
Expand Down Expand Up @@ -86,7 +87,7 @@ def instruction():

# Passing in dataset as the last argument in test_label_image since it needs
# to be deleted before the annotation_spec_set can be deleted.
@pytest.mark.slow
@pytest.mark.flaky(max_runs=3)
def test_label_video(capsys, annotation_spec_set, instruction, dataset):

# Start labeling.
Expand Down
3 changes: 2 additions & 1 deletion datalabeling/manage_dataset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@

import os

import manage_dataset
import pytest

import manage_dataset

PROJECT_ID = os.getenv("GCLOUD_PROJECT")


Expand Down

0 comments on commit e8c0db8

Please sign in to comment.