Skip tests properly (#31308)
* Skip tests properly * [test_all] * Add 'reason' as kwarg for skipTest * [test_all] Fix up * [test_all]
This commit is contained in:
@@ -520,11 +520,11 @@ class TapasModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
|
||||
self.model_tester.create_and_check_for_sequence_classification(*config_and_inputs)
|
||||
|
||||
@require_tensorflow_probability
|
||||
@unittest.skip("tfp is not defined even if installed. FIXME @Arthur in a followup PR!")
|
||||
@unittest.skip(reason="tfp is not defined even if installed. FIXME @Arthur in a followup PR!")
|
||||
def test_pt_tf_model_equivalence(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("tfp is not defined even if installed. FIXME @Arthur in a followup PR!")
|
||||
@unittest.skip(reason="tfp is not defined even if installed. FIXME @Arthur in a followup PR!")
|
||||
def test_tf_from_pt_safetensors(self):
|
||||
pass
|
||||
|
||||
|
||||
@@ -158,13 +158,13 @@ class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
for tokenizer in tokenizers:
|
||||
with self.subTest(f"{tokenizer.__class__.__name__}"):
|
||||
if tokenizer.__class__ not in MODEL_TOKENIZER_MAPPING:
|
||||
return
|
||||
self.skipTest(f"{tokenizer.__class__} is not in the MODEL_TOKENIZER_MAPPING")
|
||||
|
||||
config_class, model_class = MODEL_TOKENIZER_MAPPING[tokenizer.__class__]
|
||||
config = config_class()
|
||||
|
||||
if config.is_encoder_decoder or config.pad_token_id is None:
|
||||
return
|
||||
self.skipTest(reason="Model is an encoder-decoder or does not have a pad token id set")
|
||||
|
||||
model = model_class(config)
|
||||
|
||||
@@ -184,7 +184,7 @@ class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
|
||||
def test_rust_and_python_full_tokenizers(self):
|
||||
if not self.test_rust_tokenizer:
|
||||
return
|
||||
self.skipTest(reason="test_rust_tokenizer is set to False")
|
||||
|
||||
tokenizer = self.get_tokenizer()
|
||||
rust_tokenizer = self.get_rust_tokenizer()
|
||||
@@ -223,7 +223,7 @@ class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
rust_ids = rust_tokenizer.encode(sequence)
|
||||
self.assertListEqual(ids, rust_ids)
|
||||
|
||||
@unittest.skip("Chat template tests don't play well with table/layout models.")
|
||||
@unittest.skip(reason="Chat template tests don't play well with table/layout models.")
|
||||
def test_chat_template_batched(self):
|
||||
pass
|
||||
|
||||
@@ -633,11 +633,11 @@ class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
sequences, mask = information["input_ids"], information["token_type_ids"]
|
||||
self.assertEqual(len(sequences), len(mask))
|
||||
|
||||
@unittest.skip("TAPAS tokenizer only handles two sequences.")
|
||||
@unittest.skip(reason="TAPAS tokenizer only handles two sequences.")
|
||||
def test_maximum_encoding_length_pair_input(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("TAPAS tokenizer only handles two sequences.")
|
||||
@unittest.skip(reason="TAPAS tokenizer only handles two sequences.")
|
||||
def test_maximum_encoding_length_single_input(self):
|
||||
pass
|
||||
|
||||
@@ -779,7 +779,7 @@ class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
encoded_sequences_batch_padded_2[key],
|
||||
)
|
||||
|
||||
@unittest.skip("batch_encode_plus does not handle overflowing tokens.")
|
||||
@unittest.skip(reason="batch_encode_plus does not handle overflowing tokens.")
|
||||
def test_batch_encode_plus_overflowing_tokens(self):
|
||||
pass
|
||||
|
||||
@@ -846,7 +846,7 @@ class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
with self.subTest(f"{tokenizer.__class__.__name__}"):
|
||||
table = self.get_table(tokenizer, length=0)
|
||||
if tokenizer.pad_token is None:
|
||||
self.skipTest("No padding token.")
|
||||
self.skipTest(reason="No padding token.")
|
||||
else:
|
||||
empty_tokens = tokenizer(table, padding=True, pad_to_multiple_of=8)
|
||||
normal_tokens = tokenizer(table, "This is a sample input", padding=True, pad_to_multiple_of=8)
|
||||
@@ -864,7 +864,9 @@ class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
for key, value in normal_tokens.items():
|
||||
self.assertEqual(len(value) % 8, 0, f"BatchEncoding.{key} is not multiple of 8")
|
||||
|
||||
@unittest.skip("TAPAS cannot handle `prepare_for_model` without passing by `encode_plus` or `batch_encode_plus`")
|
||||
@unittest.skip(
|
||||
reason="TAPAS cannot handle `prepare_for_model` without passing by `encode_plus` or `batch_encode_plus`"
|
||||
)
|
||||
def test_prepare_for_model(self):
|
||||
pass
|
||||
|
||||
@@ -948,7 +950,7 @@ class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
|
||||
shutil.rmtree(tmpdirname)
|
||||
|
||||
@unittest.skip("Not implemented")
|
||||
@unittest.skip(reason="Not implemented")
|
||||
def test_right_and_left_truncation(self):
|
||||
pass
|
||||
|
||||
@@ -1051,13 +1053,13 @@ class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
for tokenizer in tokenizers:
|
||||
with self.subTest(f"{tokenizer.__class__.__name__}"):
|
||||
if tokenizer.__class__ not in MODEL_TOKENIZER_MAPPING:
|
||||
return
|
||||
self.skipTest(f"{tokenizer.__class__} is not in the MODEL_TOKENIZER_MAPPING")
|
||||
|
||||
config_class, model_class = MODEL_TOKENIZER_MAPPING[tokenizer.__class__]
|
||||
config = config_class()
|
||||
|
||||
if config.is_encoder_decoder or config.pad_token_id is None:
|
||||
return
|
||||
self.skipTest(reason="Model is an encoder-decoder or has no padding token set.")
|
||||
|
||||
model = model_class(config)
|
||||
|
||||
@@ -1081,7 +1083,7 @@ class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
model(**encoded_sequence)
|
||||
model(**batch_encoded_sequence)
|
||||
|
||||
@unittest.skip("TAPAS doesn't handle pre-tokenized inputs.")
|
||||
@unittest.skip(reason="TAPAS doesn't handle pre-tokenized inputs.")
|
||||
def test_pretokenized_inputs(self):
|
||||
pass
|
||||
|
||||
@@ -1268,10 +1270,10 @@ class TapasTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
self.assertListEqual(column_ids.tolist(), expected_results["column_ids"])
|
||||
self.assertListEqual(row_ids.tolist(), expected_results["row_ids"])
|
||||
|
||||
@unittest.skip("Doesn't support another framework than PyTorch")
|
||||
@unittest.skip(reason="Doesn't support another framework than PyTorch")
|
||||
def test_np_encode_plus_sent_to_model(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("Chat is not supported")
|
||||
@unittest.skip(reason="Chat is not supported")
|
||||
def test_chat_template(self):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user