Skip to content

Commit d511861

Browse files
committed
refactor: simplify sys exit test
1 parent b83fe16 commit d511861

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

tests/test_sys_exit.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
import subprocess
22

3+
import pytest
4+
35

46
def test_correct_sys_exit_error_python():
5-
try:
7+
with pytest.raises(subprocess.CalledProcessError):
68
subprocess.run(
79
["stac-validator", "tests/test_data/bad_data/bad_item_v090.json"],
810
check=True,
911
)
10-
assert False
11-
except subprocess.CalledProcessError:
12-
assert True
1312

1413

1514
def test_false_sys_exit_error_python():
16-
try:
17-
subprocess.run(
18-
["stac-validator", "tests/test_data/v090/items/good_item_v090.json"],
19-
check=True,
20-
)
21-
assert True
22-
except subprocess.CalledProcessError:
23-
assert False
15+
subprocess.run(
16+
["stac-validator", "tests/test_data/v090/items/good_item_v090.json"],
17+
check=True,
18+
)

0 commit comments

Comments
 (0)