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:
@@ -110,7 +110,7 @@ class UdopTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
# this tokenizer
|
||||
def test_save_sentencepiece_tokenizer(self) -> None:
|
||||
if not self.test_sentencepiece or not self.test_slow_tokenizer:
|
||||
return
|
||||
self.skipTest(reason="test_sentencepiece or test_slow_tokenizer is set to False")
|
||||
# We want to verify that we will be able to save the tokenizer even if the original files that were used to
|
||||
# build the tokenizer have been deleted in the meantime.
|
||||
words, boxes = self.get_words_and_boxes()
|
||||
@@ -687,7 +687,7 @@ class UdopTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
|
||||
def test_padding_warning_message_fast_tokenizer(self):
|
||||
if not self.test_rust_tokenizer:
|
||||
return
|
||||
self.skipTest(reason="test_rust_tokenizer is set to False")
|
||||
|
||||
words, boxes = self.get_words_and_boxes_batch()
|
||||
|
||||
@@ -708,7 +708,7 @@ class UdopTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
)
|
||||
|
||||
if not self.test_slow_tokenizer:
|
||||
return
|
||||
self.skipTest(reason="test_slow_tokenizer is set to False")
|
||||
|
||||
tokenizer_slow = self.get_tokenizer()
|
||||
|
||||
@@ -817,7 +817,7 @@ class UdopTokenizationTest(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
|
||||
|
||||
@@ -878,7 +878,7 @@ class UdopTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
for tokenizer in tokenizers:
|
||||
with self.subTest(f"{tokenizer.__class__.__name__}"):
|
||||
if tokenizer.pad_token is None:
|
||||
self.skipTest("No padding token.")
|
||||
self.skipTest(reason="No padding token.")
|
||||
else:
|
||||
words, boxes = self.get_words_and_boxes()
|
||||
|
||||
@@ -919,7 +919,7 @@ class UdopTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
def test_build_inputs_with_special_tokens(self):
|
||||
if not self.test_slow_tokenizer:
|
||||
# as we don't have a slow version, we can't compare the outputs between slow and fast versions
|
||||
return
|
||||
self.skipTest(reason="test_slow_tokenizer is set to False")
|
||||
|
||||
for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
|
||||
with self.subTest(f"{tokenizer.__class__.__name__} ({pretrained_name})"):
|
||||
@@ -1008,7 +1008,7 @@ class UdopTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
|
||||
shutil.rmtree(tmpdirname)
|
||||
|
||||
@unittest.skip("Not implemented")
|
||||
@unittest.skip(reason="Not implemented")
|
||||
def test_right_and_left_truncation(self):
|
||||
pass
|
||||
|
||||
@@ -1153,11 +1153,11 @@ class UdopTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
# Assert there is online added_tokens special_tokens
|
||||
self.assertEqual(sum(tokens_with_offsets["special_tokens_mask"]), added_tokens)
|
||||
|
||||
@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(self):
|
||||
pass
|
||||
|
||||
@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
|
||||
|
||||
@@ -1174,13 +1174,13 @@ class UdopTokenizationTest(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__} not in 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)
|
||||
|
||||
@@ -1206,11 +1206,11 @@ class UdopTokenizationTest(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")
|
||||
|
||||
if not self.test_slow_tokenizer:
|
||||
# as we don't have a slow version, we can't compare the outputs between slow and fast versions
|
||||
return
|
||||
self.skipTest(reason="test_slow_tokenizer is set to False")
|
||||
|
||||
tokenizer = self.get_tokenizer()
|
||||
rust_tokenizer = self.get_rust_tokenizer()
|
||||
@@ -1228,7 +1228,7 @@ class UdopTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
def test_tokenization_python_rust_equals(self):
|
||||
if not self.test_slow_tokenizer:
|
||||
# as we don't have a slow version, we can't compare the outputs between slow and fast versions
|
||||
return
|
||||
self.skipTest(reason="test_slow_tokenizer is set to False")
|
||||
|
||||
for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
|
||||
with self.subTest(f"{tokenizer.__class__.__name__} ({pretrained_name})"):
|
||||
@@ -1282,7 +1282,7 @@ class UdopTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
def test_embeded_special_tokens(self):
|
||||
if not self.test_slow_tokenizer:
|
||||
# as we don't have a slow version, we can't compare the outputs between slow and fast versions
|
||||
return
|
||||
self.skipTest(reason="test_slow_tokenizer is set to False")
|
||||
|
||||
for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
|
||||
with self.subTest(f"{tokenizer.__class__.__name__} ({pretrained_name})"):
|
||||
@@ -1478,7 +1478,7 @@ class UdopTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
def test_training_new_tokenizer(self):
|
||||
# This feature only exists for fast tokenizers
|
||||
if not self.test_rust_tokenizer:
|
||||
return
|
||||
self.skipTest(reason="test_rust_tokenizer is set to False")
|
||||
|
||||
tokenizer = self.get_rust_tokenizer()
|
||||
new_tokenizer = tokenizer.train_new_from_iterator(SMALL_TRAINING_CORPUS, 100)
|
||||
@@ -1515,7 +1515,7 @@ class UdopTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
def test_training_new_tokenizer_with_special_tokens_change(self):
|
||||
# This feature only exists for fast tokenizers
|
||||
if not self.test_rust_tokenizer:
|
||||
return
|
||||
self.skipTest(reason="test_rust_tokenizer is set to False")
|
||||
|
||||
tokenizer = self.get_rust_tokenizer()
|
||||
# Test with a special tokens map
|
||||
@@ -1628,7 +1628,7 @@ class UdopTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
def test_padding_different_model_input_name(self):
|
||||
if not self.test_slow_tokenizer:
|
||||
# as we don't have a slow version, we can't compare the outputs between slow and fast versions
|
||||
return
|
||||
self.skipTest(reason="test_slow_tokenizer is set to False")
|
||||
|
||||
for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
|
||||
with self.subTest(f"{tokenizer.__class__.__name__} ({pretrained_name})"):
|
||||
@@ -1722,27 +1722,27 @@ class UdopTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
self.assertEqual(len(tokens[key].shape), 3)
|
||||
self.assertEqual(tokens[key].shape[-1], 4)
|
||||
|
||||
@unittest.skip("TO DO: overwrite this very extensive test.")
|
||||
@unittest.skip(reason="TO DO: overwrite this very extensive test.")
|
||||
def test_alignement_methods(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("UDOP tokenizer requires boxes besides sequences.")
|
||||
@unittest.skip(reason="UDOP tokenizer requires boxes besides sequences.")
|
||||
def test_maximum_encoding_length_pair_input(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("UDOP tokenizer requires boxes besides sequences.")
|
||||
@unittest.skip(reason="UDOP tokenizer requires boxes besides sequences.")
|
||||
def test_maximum_encoding_length_single_input(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("UDOP tokenizer requires boxes besides sequences.")
|
||||
@unittest.skip(reason="UDOP tokenizer requires boxes besides sequences.")
|
||||
def test_pretokenized_inputs(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("UDOP tokenizer always expects pretokenized inputs.")
|
||||
@unittest.skip(reason="UDOP tokenizer always expects pretokenized inputs.")
|
||||
def test_compare_pretokenized_inputs(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("UDOP fast tokenizer does not support prepare_for_model")
|
||||
@unittest.skip(reason="UDOP fast tokenizer does not support prepare_for_model")
|
||||
def test_compare_prepare_for_model(self):
|
||||
pass
|
||||
|
||||
@@ -1863,15 +1863,15 @@ class UdopTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
self.assertDictEqual(dict(encoding_p), expected_results)
|
||||
self.assertDictEqual(dict(encoding_r), expected_results)
|
||||
|
||||
@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("Doesn't use SentencePiece")
|
||||
@unittest.skip(reason="Doesn't use SentencePiece")
|
||||
def test_sentencepiece_tokenize_and_convert_tokens_to_string(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("Doesn't use SentencePiece")
|
||||
@unittest.skip(reason="Doesn't use SentencePiece")
|
||||
def test_sentencepiece_tokenize_and_decode(self):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user