Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_run_from_designspace(self, mock):
self.assertFalse(mock.called)
entry.main(["-m", "someDesignspace.designspace"])
self.assertTrue(mock.called)
def test_run_from_glyphs(self, mock):
self.assertFalse(mock.called)
entry.main(["-g", "someGlyphs.glyph"])
self.assertTrue(mock.called)
def test_interpolation(data_dir, tmp_path):
shutil.copytree(data_dir / "DesignspaceTest", tmp_path / "sources")
fontmake.__main__.main(
[
"-m",
str(tmp_path / "sources" / "DesignspaceTest.designspace"),
"-i",
"--output-dir",
str(tmp_path),
]
)
assert {p.name for p in tmp_path.glob("*.*")} == {
"MyFont-Regular.ttf",
"MyFont-Regular.otf",
}
test_output_ttf = fontTools.ttLib.TTFont(tmp_path / "MyFont-Regular.ttf")
assert test_output_ttf["OS/2"].usWeightClass == 400
def test_mti_sources(data_dir, tmp_path):
shutil.copytree(data_dir / "InterpolateLayoutTest", tmp_path / "sources")
fontmake.__main__.main(
[
"-g",
str(tmp_path / "sources" / "InterpolateLayoutTest.glyphs"),
"--designspace-path",
str(tmp_path / "InterpolateLayoutTest.designspace"),
"--master-dir",
str(tmp_path / "master_ufos"),
"--instance-dir",
str(tmp_path / "instance_ufos"),
"--mti-source",
str(tmp_path / "sources" / "InterpolateLayoutTest.plist"),
"--no-production-names",
"--output-dir",
str(tmp_path),
]
)