Skip to content

Commit 0945189

Browse files
test(losses): use self.skipTest instead of bare return for CUDA skip
Bare `return` in unittest does not signal a skip — pytest emits a warning ("Did you mean to use assert instead of return?"). Replace with `self.skipTest("CUDA not available")` which correctly marks the test as skipped and is consistent with MONAI conventions. Signed-off-by: Oleksandr Sanin <alexaaander.sanin@gmail.com>
1 parent 4ad65e4 commit 0945189

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tests/losses/image_dissimilarity/test_global_mutual_information_loss.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def test_gaussian_buffers_move_with_module(self):
181181
self.assertEqual(loss.preterm.device.type, "cpu")
182182
self.assertEqual(loss.bin_centers.device.type, "cpu")
183183
if not torch.cuda.is_available():
184-
return
184+
self.skipTest("CUDA not available")
185185
loss = loss.cuda()
186186
self.assertEqual(loss.preterm.device.type, "cuda")
187187
self.assertEqual(loss.bin_centers.device.type, "cuda")

0 commit comments

Comments
 (0)