Skip to content

Commit ef40c04

Browse files
Replace unittest skipTest with pytest.skip (#4263)
1 parent 7e0adbc commit ef40c04

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

tests/slow/test_grpo_slow.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,11 @@ def reward_func(prompts, completions, **kwargs):
329329
assert lora_params_changed, "No LoRA parameters were updated during training."
330330

331331
except torch.OutOfMemoryError as e:
332-
self.skipTest(f"Skipping VLM training test due to insufficient GPU memory: {e}")
332+
pytest.skip(f"Skipping VLM training test due to insufficient GPU memory: {e}")
333333
except Exception as e:
334334
# Check for other memory-related errors
335335
if any(keyword in str(e).lower() for keyword in ["memory", "cuda", "out of memory", "insufficient"]):
336-
self.skipTest(f"Skipping VLM training test due to hardware constraints: {e}")
336+
pytest.skip(f"Skipping VLM training test due to hardware constraints: {e}")
337337
else:
338338
raise
339339

@@ -474,11 +474,11 @@ def dummy_reward_func(completions, **kwargs):
474474
"decrease gpu memory",
475475
]
476476
):
477-
self.skipTest(f"Skipping vLLM colocate test due to hardware constraints: {e}")
477+
pytest.skip(f"Skipping vLLM colocate test due to hardware constraints: {e}")
478478
elif "KeyError" in str(e) and "RANK" in str(e):
479-
self.skipTest(f"Skipping vLLM colocate test due to environment setup issues: {e}")
479+
pytest.skip(f"Skipping vLLM colocate test due to environment setup issues: {e}")
480480
elif "ValueError" in str(e) and "memory" in str(e).lower():
481-
self.skipTest(f"Skipping vLLM colocate test due to memory constraints: {e}")
481+
pytest.skip(f"Skipping vLLM colocate test due to memory constraints: {e}")
482482
else:
483483
raise
484484
finally:
@@ -541,11 +541,11 @@ def test_training_vllm(self):
541541
"decrease gpu memory",
542542
]
543543
):
544-
self.skipTest(f"Skipping vLLM training test due to hardware constraints: {e}")
544+
pytest.skip(f"Skipping vLLM training test due to hardware constraints: {e}")
545545
elif "KeyError" in str(e) and "RANK" in str(e):
546-
self.skipTest(f"Skipping vLLM training test due to environment setup issues: {e}")
546+
pytest.skip(f"Skipping vLLM training test due to environment setup issues: {e}")
547547
elif "ValueError" in str(e) and "memory" in str(e).lower():
548-
self.skipTest(f"Skipping vLLM training test due to memory constraints: {e}")
548+
pytest.skip(f"Skipping vLLM training test due to memory constraints: {e}")
549549
else:
550550
raise
551551

tests/test_gkd_trainer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def test_gkd_trainer_with_liger(self):
259259

260260
# Ensure liger fused JSD path is enabled; if not, skip (runtime may lack system libs)
261261
if not getattr(trainer, "use_liger_gkd_loss", False):
262-
self.skipTest("Liger fused JSD not enabled at runtime; skipping fused-loss assertion")
262+
pytest.skip("Liger fused JSD not enabled at runtime; skipping fused-loss assertion")
263263

264264
trainer.train()
265265

0 commit comments

Comments
 (0)