Skip to content

Commit 4952963

Browse files
Added tests to test --long-list, --full-list and --summary
1 parent 4b8cf50 commit 4952963

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

dpctl/tests/test_service.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,49 @@ def test_cmakedir():
182182
assert res.stdout
183183
cmake_dir = res.stdout.decode("utf-8").strip()
184184
assert os.path.exists(os.path.join(cmake_dir, "FindDpctl.cmake"))
185+
186+
187+
def test_main_full_list():
188+
res = subprocess.run(
189+
[sys.executable, "-m", "dpctl", "-f"], capture_output=True
190+
)
191+
assert res.returncode == 0
192+
assert res.stdout
193+
assert res.stdout.decode("utf-8")
194+
195+
196+
def test_main_long_list():
197+
res = subprocess.run(
198+
[sys.executable, "-m", "dpctl", "-l"], capture_output=True
199+
)
200+
assert res.returncode == 0
201+
assert res.stdout
202+
assert res.stdout.decode("utf-8")
203+
204+
205+
def test_main_summary():
206+
res = subprocess.run(
207+
[sys.executable, "-m", "dpctl", "-s"], capture_output=True
208+
)
209+
assert res.returncode == 0
210+
assert res.stdout
211+
assert res.stdout.decode("utf-8")
212+
213+
214+
def test_main_warnings():
215+
res = subprocess.run(
216+
[sys.executable, "-m", "dpctl", "-s", "--includes"], capture_output=True
217+
)
218+
assert res.returncode == 0
219+
assert res.stdout
220+
assert "UserWarning" in res.stderr.decode("utf-8")
221+
assert "is being ignored." in res.stderr.decode("utf-8")
222+
223+
res = subprocess.run(
224+
[sys.executable, "-m", "dpctl", "-s", "--includes", "--cmakedir"],
225+
capture_output=True,
226+
)
227+
assert res.returncode == 0
228+
assert res.stdout
229+
assert "UserWarning" in res.stderr.decode("utf-8")
230+
assert "are being ignored." in res.stderr.decode("utf-8")

0 commit comments

Comments
 (0)