Skip to content

Commit 67058ba

Browse files
committed
.
1 parent 8af39b0 commit 67058ba

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ def needs_cuda(test_item):
2222

2323

2424
def cpu_and_cuda():
25+
if not torch.cuda.is_available():
26+
if os.environ.get("FAIL_WITHOUT_CUDA") == "1":
27+
raise RuntimeError("CUDA is required for this test")
28+
return ("cpu",)
2529
return ("cpu", pytest.param("cuda", marks=pytest.mark.needs_cuda))
2630

2731

0 commit comments

Comments
 (0)