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:
@@ -101,7 +101,7 @@ class MarkupLMTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
|
||||
return questions, nodes, xpaths
|
||||
|
||||
@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
|
||||
|
||||
@@ -207,7 +207,7 @@ class MarkupLMTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
decoded = tokenizer.decode(encoded, spaces_between_special_tokens=self.space_between_special_tokens)
|
||||
self.assertIn(decoded, [output, output.lower()])
|
||||
|
||||
@unittest.skip("Not implemented")
|
||||
@unittest.skip(reason="Not implemented")
|
||||
def test_right_and_left_truncation(self):
|
||||
pass
|
||||
|
||||
@@ -708,7 +708,7 @@ class MarkupLMTokenizationTest(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
|
||||
|
||||
@@ -769,7 +769,7 @@ class MarkupLMTokenizationTest(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:
|
||||
nodes, xpaths = self.get_nodes_and_xpaths()
|
||||
|
||||
@@ -814,7 +814,7 @@ class MarkupLMTokenizationTest(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})"):
|
||||
@@ -1056,13 +1056,13 @@ class MarkupLMTokenizationTest(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 set")
|
||||
|
||||
model = model_class(config)
|
||||
|
||||
@@ -1088,11 +1088,11 @@ class MarkupLMTokenizationTest(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()
|
||||
@@ -1110,7 +1110,7 @@ class MarkupLMTokenizationTest(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})"):
|
||||
@@ -1172,7 +1172,7 @@ class MarkupLMTokenizationTest(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})"):
|
||||
@@ -1367,7 +1367,7 @@ class MarkupLMTokenizationTest(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)
|
||||
@@ -1406,7 +1406,7 @@ class MarkupLMTokenizationTest(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
|
||||
@@ -1519,7 +1519,7 @@ class MarkupLMTokenizationTest(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})"):
|
||||
@@ -1613,7 +1613,7 @@ class MarkupLMTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
self.assertEqual(len(tokens[key].shape), 3)
|
||||
self.assertEqual(tokens[key].shape[-2], 6)
|
||||
|
||||
@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
|
||||
|
||||
@@ -2152,15 +2152,15 @@ class MarkupLMTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
self.assertEqual(xpath_tags_seq, sequence["xpath_tags_seq"][:-2])
|
||||
self.assertEqual(overflowing_xpath_tags_seq, sequence["xpath_tags_seq"][-(2 + stride) :])
|
||||
|
||||
@unittest.skip("MarkupLM tokenizer requires xpaths besides sequences.")
|
||||
@unittest.skip(reason="MarkupLM tokenizer requires xpaths besides sequences.")
|
||||
def test_pretokenized_inputs(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("MarkupLM tokenizer always expects pretokenized inputs.")
|
||||
@unittest.skip(reason="MarkupLM tokenizer always expects pretokenized inputs.")
|
||||
def test_compare_pretokenized_inputs(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("MarkupLM fast tokenizer does not support prepare_for_model")
|
||||
@unittest.skip(reason="MarkupLM fast tokenizer does not support prepare_for_model")
|
||||
def test_compare_prepare_for_model(self):
|
||||
pass
|
||||
|
||||
@@ -2264,13 +2264,13 @@ class MarkupLMTokenizationTest(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
|
||||
|
||||
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")
|
||||
|
||||
nodes, xpaths = self.get_nodes_and_xpaths()
|
||||
|
||||
@@ -2290,7 +2290,7 @@ class MarkupLMTokenizationTest(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()
|
||||
# check correct behaviour if no pad_token_id exists and add it eventually
|
||||
@@ -2309,10 +2309,10 @@ class MarkupLMTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
|
||||
cm.records[0].message,
|
||||
)
|
||||
|
||||
@unittest.skip("Chat is not supported")
|
||||
@unittest.skip(reason="Chat is not supported")
|
||||
def test_chat_template(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("The model tested fails `Hub -> Fast == Hub -> Slow`, nothing much we can do")
|
||||
@unittest.skip(reason="The model tested fails `Hub -> Fast == Hub -> Slow`, nothing much we can do")
|
||||
def test_added_tokens_serialization(self):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user