Replace unittest skipTest with pytest.skip (#4263)

This commit is contained in:
Albert Villanova del Moral
2025-10-15 18:15:28 +02:00
committed by GitHub
parent 7e0adbc552
commit ef40c047aa
2 changed files with 9 additions and 9 deletions

View File

@ -329,11 +329,11 @@ class TestGRPOTrainerSlow(TrlTestCase):
assert lora_params_changed, "No LoRA parameters were updated during training."
except torch.OutOfMemoryError as e:
self.skipTest(f"Skipping VLM training test due to insufficient GPU memory: {e}")
pytest.skip(f"Skipping VLM training test due to insufficient GPU memory: {e}")
except Exception as e:
# Check for other memory-related errors
if any(keyword in str(e).lower() for keyword in ["memory", "cuda", "out of memory", "insufficient"]):
self.skipTest(f"Skipping VLM training test due to hardware constraints: {e}")
pytest.skip(f"Skipping VLM training test due to hardware constraints: {e}")
else:
raise
@ -474,11 +474,11 @@ class TestGRPOTrainerSlow(TrlTestCase):
"decrease gpu memory",
]
):
self.skipTest(f"Skipping vLLM colocate test due to hardware constraints: {e}")
pytest.skip(f"Skipping vLLM colocate test due to hardware constraints: {e}")
elif "KeyError" in str(e) and "RANK" in str(e):
self.skipTest(f"Skipping vLLM colocate test due to environment setup issues: {e}")
pytest.skip(f"Skipping vLLM colocate test due to environment setup issues: {e}")
elif "ValueError" in str(e) and "memory" in str(e).lower():
self.skipTest(f"Skipping vLLM colocate test due to memory constraints: {e}")
pytest.skip(f"Skipping vLLM colocate test due to memory constraints: {e}")
else:
raise
finally:
@ -541,11 +541,11 @@ class TestGRPOTrainerSlow(TrlTestCase):
"decrease gpu memory",
]
):
self.skipTest(f"Skipping vLLM training test due to hardware constraints: {e}")
pytest.skip(f"Skipping vLLM training test due to hardware constraints: {e}")
elif "KeyError" in str(e) and "RANK" in str(e):
self.skipTest(f"Skipping vLLM training test due to environment setup issues: {e}")
pytest.skip(f"Skipping vLLM training test due to environment setup issues: {e}")
elif "ValueError" in str(e) and "memory" in str(e).lower():
self.skipTest(f"Skipping vLLM training test due to memory constraints: {e}")
pytest.skip(f"Skipping vLLM training test due to memory constraints: {e}")
else:
raise

View File

@ -259,7 +259,7 @@ class TestGKDTrainer(TrlTestCase):
# Ensure liger fused JSD path is enabled; if not, skip (runtime may lack system libs)
if not getattr(trainer, "use_liger_gkd_loss", False):
self.skipTest("Liger fused JSD not enabled at runtime; skipping fused-loss assertion")
pytest.skip("Liger fused JSD not enabled at runtime; skipping fused-loss assertion")
trainer.train()