summaryrefslogtreecommitdiffstats
path: root/tests/runmakefeatests.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-02 20:01:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-02 20:01:10 +0000
commitda875fcb62c801b8d19b3d4d984ad963574fb356 (patch)
tree3d85503747c56c2a387b291524442946f4bebb73 /tests/runmakefeatests.py
parentInitial commit. (diff)
downloadpysilfont-da875fcb62c801b8d19b3d4d984ad963574fb356.tar.xz
pysilfont-da875fcb62c801b8d19b3d4d984ad963574fb356.zip
Adding upstream version 1.6.0.upstream/1.6.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/runmakefeatests.py')
-rw-r--r--tests/runmakefeatests.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/runmakefeatests.py b/tests/runmakefeatests.py
new file mode 100644
index 0000000..7243202
--- /dev/null
+++ b/tests/runmakefeatests.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+''' Test of script named in testname below
+'''
+__url__ = 'http://github.com/silnrsi/pysilfont'
+__copyright__ = 'Copyright (c) 2019 SIL International (http://www.sil.org)'
+__license__ = 'Released under the MIT License (http://opensource.org/licenses/MIT)'
+__author__ = 'David Raymond'
+
+import silfont.util
+
+# Next 7 lines of code may be test-specific
+import os
+import silfont.scripts.psfmakefea as testcommand
+from glob import glob
+
+testname = "psfmakefea"
+outdir = "local/testresults/psfmakefea"
+cl = "psfmakefea -i tests/input/{name}.feax -o {outdir}/{name}.fea -l {outdir}/{name}.log"
+outfont = None # Set to None for commands which don't output a font
+diffexts = [".fea", ".log"] # List of extensions of all output files
+exp_errors = 0 # These may need updating if the test ufo is updated
+exp_warnings = 0 # The test ufo should have some errors/warnings to test the code!
+test_files = [os.path.splitext(os.path.basename(f))[0] for f in glob("tests/input/*.feax")]
+# Code after this can be the same for most/all tests; if needed to be different for a test remove this comment!
+
+def test_run():
+ if not os.path.exists(outdir):
+ os.makedirs(outdir)
+ for name in test_files:
+ command = cl.format(name=name, outdir=outdir)
+ result = silfont.util.test_run(None, command, testcommand, outfont, exp_errors, exp_warnings)
+ assert result
+
+def test_diffs(): # Do a diff on all output files
+ for name in test_files:
+ result = silfont.util.test_diffs("psfmakefea", name, diffexts)
+ assert result
+
+if __name__ == "__main__":
+ test_run()
+ test_diffs()
+
+
+
+
+