Skip to content

Commit

Permalink
Skip yaml-dependent tests if yaml isn't installed
Browse files Browse the repository at this point in the history
  • Loading branch information
jesper-friis committed Aug 18, 2023
1 parent ce07ca0 commit 0e01166
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions bindings/python/tests/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
except ModuleNotFoundError:
HAVE_PYTEST = False

try:
import yaml
HAVE_YAML = True
except ModuleNotFoundError:
HAVE_YAML = False


thisdir = os.path.abspath(os.path.dirname(__file__))

Expand Down Expand Up @@ -45,11 +51,7 @@


# Test yaml
try:
import yaml
except ImportError:
pass
else:
if HAVE_YAML:
print('--- testing yaml')
inst.save('yaml://inst.yaml?mode=w')
del inst
Expand Down Expand Up @@ -104,7 +106,8 @@


# Tests for issue #587
bytearr = inst.to_bytes("yaml")
if HAVE_YAML:
bytearr = inst.to_bytes("yaml")
#print(bytes(bytearr).decode())
if HAVE_PYTEST:
with pytest.raises(dlite.DLiteError):
Expand Down

0 comments on commit 0e01166

Please sign in to comment.