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:
amyeroberts
2024-06-26 21:59:08 +01:00
committed by GitHub
parent 1f9f57ab4c
commit 1de7dc7403
254 changed files with 1721 additions and 1298 deletions

View File

@@ -408,11 +408,11 @@ class Qwen2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi
(self.model_tester.batch_size, self.model_tester.seq_length, self.model_tester.num_labels),
)
@unittest.skip("Qwen2 buffers include complex numbers, which breaks this test")
@unittest.skip(reason="Qwen2 buffers include complex numbers, which breaks this test")
def test_save_load_fast_init_from_base(self):
pass
@unittest.skip("Qwen2 uses GQA on all models so the KV cache is a non standard format")
@unittest.skip(reason="Qwen2 uses GQA on all models so the KV cache is a non standard format")
def test_past_key_values_format(self):
pass
@@ -500,7 +500,7 @@ class Qwen2ModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixi
@pytest.mark.flash_attn_test
@slow
def test_flash_attn_2_inference_equivalence_right_padding(self):
self.skipTest("Qwen2 flash attention does not support right padding")
self.skipTest(reason="Qwen2 flash attention does not support right padding")
@require_torch

View File

@@ -136,14 +136,14 @@ class Qwen2TokenizationTest(TokenizerTesterMixin, unittest.TestCase):
input_bpe_tokens = [75, 78, 86, 260, 259, 260, 220, 77, 68, 86, 260, 220, 15, 16, 15, 266, 270, 267]
self.assertListEqual(tokenizer.convert_tokens_to_ids(input_tokens), input_bpe_tokens)
@unittest.skip("We disable the test of pretokenization as it is not reversible.")
@unittest.skip(reason="We disable the test of pretokenization as it is not reversible.")
def test_pretokenized_inputs(self):
# the test case in parent class uses str.split to "pretokenize",
# which eats the whitespaces, which, in turn, is not reversible.
# the results, by nature, should be different.
pass
@unittest.skip("We disable the test of clean up tokenization spaces as it is not applicable.")
@unittest.skip(reason="We disable the test of clean up tokenization spaces as it is not applicable.")
def test_clean_up_tokenization_spaces(self):
# it only tests bert-base-uncased and clean_up_tokenization_spaces is not applicable to this tokenizer
pass
@@ -169,7 +169,7 @@ class Qwen2TokenizationTest(TokenizerTesterMixin, unittest.TestCase):
def test_slow_tokenizer_token_with_number_sign(self):
if not self.test_slow_tokenizer:
return
self.skipTest(reason="test_slow_tokenizer is set to False")
sequence = " ###"
token_ids = [268, 269]
@@ -180,7 +180,7 @@ class Qwen2TokenizationTest(TokenizerTesterMixin, unittest.TestCase):
def test_slow_tokenizer_decode_spaces_between_special_tokens_default(self):
# Qwen2Tokenizer changes the default `spaces_between_special_tokens` in `decode` to False
if not self.test_slow_tokenizer:
return
self.skipTest(reason="test_slow_tokenizer is set to False")
# tokenizer has a special token: `"<|endfotext|>"` as eos, but it is not `legacy_added_tokens`
# special tokens in `spaces_between_special_tokens` means spaces between `legacy_added_tokens`