diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..b915743 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,15 @@ +# Copyright 2021 Adobe. All rights reserved. + +import os +import pytest + + +@pytest.fixture +def fonts_dir(): + root_dir = os.path.dirname(os.path.dirname(__file__)) + yield os.path.join(root_dir, 'fonts') + + +@pytest.fixture +def base_font_path(fonts_dir): + yield os.path.join(fonts_dir, 'Zebrawood.otf') diff --git a/tests/dumpsvg_test.py b/tests/dumpsvg_test.py new file mode 100644 index 0000000..01fef8a --- /dev/null +++ b/tests/dumpsvg_test.py @@ -0,0 +1,12 @@ +# Copyright 2021 Adobe. All rights reserved. + +import pytest + +from opentypesvg.dumpsvg import main + + +def test_font_without_svg_table(base_font_path, capsys): + with pytest.raises(SystemExit): + main([base_font_path]) + captured = capsys.readouterr() + assert captured.err == "ERROR: The font does not have the SVG table.\n"