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

@@ -208,9 +208,6 @@ class ReformerModelTester:
)
def create_and_check_reformer_model_with_lm_backward(self, config, input_ids, input_mask, choice_labels):
if not self.is_training:
return
config.is_decoder = False
config.lsh_num_chunks_after = 1
model = ReformerForMaskedLM(config=config)
@@ -328,9 +325,6 @@ class ReformerModelTester:
)
def create_and_check_reformer_feed_backward_chunking(self, config, input_ids, input_mask, choice_labels):
if not self.is_training:
return
# disable dropout
config.hidden_dropout_prob = 0
config.local_attention_probs_dropout_prob = 0
@@ -517,6 +511,8 @@ class ReformerTesterMixin:
self.model_tester.create_and_check_reformer_model(*config_and_inputs)
def test_reformer_lm_model_backward(self):
if not self.model_tester.is_training:
self.skipTest(reason="model_tester.is_training is set to False")
config_and_inputs = self.model_tester.prepare_config_and_inputs()
self.model_tester.create_and_check_reformer_model_with_lm_backward(*config_and_inputs)
@@ -539,6 +535,8 @@ class ReformerTesterMixin:
self.model_tester.create_and_check_reformer_layer_dropout_seed(*config_and_inputs, is_decoder=False)
def test_reformer_chunking_backward_equality(self):
if not self.model_tester.is_training:
self.skipTest(reason="model_tester.is_training is set to False")
config_and_inputs = self.model_tester.prepare_config_and_inputs()
self.model_tester.create_and_check_reformer_feed_backward_chunking(*config_and_inputs)
@@ -587,12 +585,12 @@ class ReformerTesterMixin:
config_and_inputs = self.model_tester.prepare_config_and_inputs()
self.model_tester.create_and_check_reformer_for_sequence_classification(*config_and_inputs, is_decoder=False)
@unittest.skip(reason="Reformer cannot keep gradients in attentions or hidden states")
def test_retain_grad_hidden_states_attentions(self):
# reformer cannot keep gradients in attentions or hidden states
return
@unittest.skip(reason="Reformer cannot resize embeddings that easily")
def test_resize_embeddings_untied(self):
# reformer cannot resize embeddings that easily
return
@@ -682,7 +680,7 @@ class ReformerLocalAttnModelTest(ReformerTesterMixin, GenerationTesterMixin, Mod
[expected_shape] * len(iter_hidden_states),
)
@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
@unittest.skip(reason="The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass
@@ -847,15 +845,15 @@ class ReformerLSHAttnModelTest(
[expected_shape] * len(iter_hidden_states),
)
@unittest.skip("Fails because the sequence length is not a multiple of 4")
@unittest.skip(reason="Fails because the sequence length is not a multiple of 4")
def test_problem_types(self):
pass
@unittest.skip("Fails because the sequence length is not a multiple of 4")
@unittest.skip(reason="Fails because the sequence length is not a multiple of 4")
def test_past_key_values_format(self):
pass
@unittest.skip("The model doesn't support left padding") # and it's not used enough to be worth fixing :)
@unittest.skip(reason="The model doesn't support left padding") # and it's not used enough to be worth fixing :)
def test_left_padding_compatibility(self):
pass

View File

@@ -61,7 +61,7 @@ class ReformerTokenizationTest(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()
@@ -125,7 +125,7 @@ class ReformerTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
padding="max_length",
)
# tokenizer has no padding token
@unittest.skip(reason="Tokenizer has no padding token")
def test_padding_different_model_input_name(self):
pass