Skip to content

Commit 67ea26e

Browse files
Add tests to dpctl._dev.verbose
1 parent 771041b commit 67ea26e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ exclude =
1313
.git
1414

1515
per-file-ignores =
16+
dpctl/_dev.pyx: E999
1617
dpctl/_sycl_context.pyx: E999, E225, E227
1718
dpctl/_sycl_device.pyx: E999, E225
1819
dpctl/_sycl_device_factory.pyx: E999, E225

dpctl/tests/test_service.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import os.path
2525
import re
2626

27+
import pytest
28+
2729
import dpctl
2830

2931

@@ -95,3 +97,20 @@ def test___version__():
9597
r"0|[1-9][0-9]*))?(\+.*)?$"
9698
)
9799
assert re.match(reg_expr, dpctl_ver) is not None
100+
101+
102+
def test_dev_utils():
103+
import dpctl._dev as dd
104+
105+
with dd.verbose():
106+
dpctl.SyclDevice().parent_device
107+
with dd.verbose(verbosity="error"):
108+
dpctl.SyclDevice().parent_device
109+
with pytest.raises(ValueError):
110+
with dd.verbose(verbosity="blah"):
111+
dpctl.SyclDevice().parent_device
112+
with dd.verbose(log_dir="/tmp"):
113+
dpctl.SyclDevice().parent_device
114+
with pytest.raises(ValueError):
115+
with dd.verbose(log_dir="/not_a_dir"):
116+
dpctl.SyclDevice().parent_device

0 commit comments

Comments
 (0)