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:
@@ -191,18 +191,18 @@ class IdeficsImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase):
|
||||
|
||||
torch.testing.assert_close(pixel_values_transform_implied, pixel_values_transform_supplied, rtol=0.0, atol=0.0)
|
||||
|
||||
@unittest.skip("not supported")
|
||||
@unittest.skip(reason="not supported")
|
||||
def test_call_numpy(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("not supported")
|
||||
@unittest.skip(reason="not supported")
|
||||
def test_call_numpy_4_channels(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("not supported")
|
||||
@unittest.skip(reason="not supported")
|
||||
def test_call_pil(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("not supported")
|
||||
@unittest.skip(reason="not supported")
|
||||
def test_call_pytorch(self):
|
||||
pass
|
||||
|
||||
@@ -316,7 +316,7 @@ class IdeficsModelTester:
|
||||
@slow
|
||||
@parameterized.expand([("float16",), ("bfloat16",), ("float32",)])
|
||||
def test_eager_matches_sdpa_inference(self, torch_dtype: str):
|
||||
self.skipTest("Idefics has a hard requirement on SDPA, skipping this test")
|
||||
self.skipTest(reason="Idefics has a hard requirement on SDPA, skipping this test")
|
||||
|
||||
|
||||
@unittest.skipIf(not is_torch_greater_or_equal_than_2_0, reason="pytorch 2.0 or higher is required")
|
||||
@@ -422,13 +422,13 @@ class IdeficsModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase)
|
||||
|
||||
def test_training(self):
|
||||
if not self.model_tester.is_training:
|
||||
return
|
||||
self.skipTest(reason="model_tester.is_training is set to False")
|
||||
|
||||
for model_class in self.all_model_classes:
|
||||
# IdeficsModel does not support training, users should use
|
||||
# IdeficsForVisionText2Text for this purpose
|
||||
if model_class == IdeficsModel:
|
||||
return
|
||||
self.skipTest(reason="IdeficsModel does not support training")
|
||||
|
||||
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
|
||||
config.return_dict = True
|
||||
@@ -442,13 +442,13 @@ class IdeficsModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase)
|
||||
|
||||
def test_training_gradient_checkpointing(self):
|
||||
if not self.model_tester.is_training:
|
||||
return
|
||||
self.skipTest(reason="model_tester.is_training is set to False")
|
||||
|
||||
for model_class in self.all_model_classes:
|
||||
# IdeficsModel does not support training, users should use
|
||||
# IdeficsForVisionText2Text for this purpose
|
||||
if model_class == IdeficsModel:
|
||||
return
|
||||
self.skipTest(reason="IdeficsModel does not support training")
|
||||
|
||||
config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
|
||||
config.use_cache = False
|
||||
@@ -575,7 +575,7 @@ class IdeficsModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase)
|
||||
@slow
|
||||
@parameterized.expand([("float16",), ("bfloat16",), ("float32",)])
|
||||
def test_eager_matches_sdpa_inference(self, torch_dtype: str):
|
||||
self.skipTest("Idefics has a hard requirement on SDPA, skipping this test")
|
||||
self.skipTest(reason="Idefics has a hard requirement on SDPA, skipping this test")
|
||||
|
||||
|
||||
@unittest.skipIf(not is_torch_greater_or_equal_than_2_0, reason="pytorch 2.0 or higher is required")
|
||||
@@ -590,11 +590,11 @@ class IdeficsForVisionText2TextTest(IdeficsModelTest, unittest.TestCase):
|
||||
)
|
||||
self.config_tester = ConfigTester(self, config_class=IdeficsConfig, hidden_size=37)
|
||||
|
||||
@unittest.skip("We only test the model that takes in multiple images")
|
||||
@unittest.skip(reason="We only test the model that takes in multiple images")
|
||||
def test_model(self):
|
||||
pass
|
||||
|
||||
@unittest.skip("We only test the model that takes in multiple images")
|
||||
@unittest.skip(reason="We only test the model that takes in multiple images")
|
||||
def test_for_token_classification(self):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user