Skip to content

Commit 5db3ebf

Browse files
committed
Exercise successful device switch in regression test
1 parent 6884cc2 commit 5db3ebf

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

python/cudf_polars/tests/test_config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@ def test_invalid_device_raises(device, monkeypatch):
9191

9292
def test_failed_device_switch_does_not_set_seen_device(monkeypatch):
9393
monkeypatch.setattr(cudf_polars.callback, "SEEN_DEVICE", None)
94-
monkeypatch.setattr(gpu, "getDevice", lambda: 0)
94+
monkeypatch.setattr(gpu, "getDevice", lambda: 1)
95+
calls = []
9596

9697
def fail_for_invalid_device(device):
98+
calls.append(device)
9799
if device == -1:
98100
raise RuntimeError("invalid device")
99101

@@ -111,6 +113,7 @@ def fail_for_invalid_device(device):
111113
pass
112114

113115
assert cudf_polars.callback.SEEN_DEVICE == 0
116+
assert calls == [-1, 0, 1]
114117

115118

116119
def test_multiple_devices_in_same_process_raise(monkeypatch):

0 commit comments

Comments
 (0)