Skip to content

Commit

Permalink
skip format-specific tests when cattrs can't be imported
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Jul 27, 2022
1 parent 50effc6 commit 0a8c32c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/serde/test_serde.py
Expand Up @@ -61,6 +61,10 @@ class Foo:
ids=lambda x: x["class_name"], # type: ignore
)
def test_serde_all_objects(fmt: str, object_info: Dict[str, Any]) -> None:
if fmt in ("json", "msgpack"):
# skip these format tests if cattrs is not installed
pytest.importorskip("cattr")

klass = getattr(ufoLib2.objects, object_info["class_name"])
loads = getattr(klass, f"{fmt}_loads")
obj = klass(*object_info["args"])
Expand Down

0 comments on commit 0a8c32c

Please sign in to comment.