Mark flaky tests (#25463)

Make CI less brittle
This commit is contained in:
amyeroberts
2023-08-11 15:26:45 +01:00
committed by GitHub
parent 11757e2bbd
commit 5e5fa0d88c
2 changed files with 3 additions and 2 deletions

View File

@@ -306,7 +306,7 @@ class TFWav2Vec2ModelTester:
model = TFWav2Vec2ForCTC(config) model = TFWav2Vec2ForCTC(config)
input_lengths = tf.constant([input_values.shape[-1] // i for i in [4, 2, 1]]) input_lengths = tf.constant([input_values.shape[-1] // i for i in [4, 2, 1]])
max_length_labels = model.wav2vec2._get_feat_extract_output_lengths(input_lengths) max_length_labels = model.wav2vec2._get_feat_extract_output_lengths(input_lengths)
labels = ids_tensor((input_values.shape[0], min(max_length_labels) - 1), model.config.vocab_size + 100) labels = ids_tensor((input_values.shape[0], min(max_length_labels) - 1), model.config.vocab_size + 500)
with pytest.raises(ValueError): with pytest.raises(ValueError):
model(input_values, labels=labels) model(input_values, labels=labels)

View File

@@ -23,7 +23,7 @@ from requests import ReadTimeout
from tests.pipelines.test_pipelines_document_question_answering import INVOICE_URL from tests.pipelines.test_pipelines_document_question_answering import INVOICE_URL
from transformers import is_torch_available, is_vision_available from transformers import is_torch_available, is_vision_available
from transformers.image_utils import ChannelDimension, get_channel_dimension_axis, make_list_of_images from transformers.image_utils import ChannelDimension, get_channel_dimension_axis, make_list_of_images
from transformers.testing_utils import require_torch, require_vision from transformers.testing_utils import is_flaky, require_torch, require_vision
if is_torch_available(): if is_torch_available():
@@ -486,6 +486,7 @@ class LoadImageTester(unittest.TestCase):
self.assertEqual(img_arr.shape, (1061, 750, 3)) self.assertEqual(img_arr.shape, (1061, 750, 3))
@is_flaky()
def test_load_img_url_timeout(self): def test_load_img_url_timeout(self):
with self.assertRaises(ReadTimeout): with self.assertRaises(ReadTimeout):
load_image(INVOICE_URL, timeout=0.001) load_image(INVOICE_URL, timeout=0.001)