mti_test: convert to pytest-style test module

This commit is contained in:
Cosimo Lupo 2023-03-07 12:00:50 +00:00
parent 501353f3df
commit ea8b9b85d7
No known key found for this signature in database
GPG Key ID: DF65A8A5A119C9A8

View File

@ -5,10 +5,10 @@ import difflib
from io import StringIO
import os
import sys
import unittest
import pytest
class MtiTest(unittest.TestCase):
class MtiTest:
GLYPH_ORDER = [
".notdef",
@ -396,19 +396,6 @@ class MtiTest(unittest.TestCase):
# 'mti/contextcoverage'
# 'mti/context-glyph'
def __init__(self, methodName):
unittest.TestCase.__init__(self, methodName)
# Python 3 renamed assertRaisesRegexp to assertRaisesRegex,
# and fires deprecation warnings if a program uses the old name.
if not hasattr(self, "assertRaisesRegex"):
self.assertRaisesRegex = self.assertRaisesRegexp
def setUp(self):
pass
def tearDown(self):
pass
@staticmethod
def getpath(testfile):
path, _ = os.path.split(__file__)
@ -423,7 +410,7 @@ class MtiTest(unittest.TestCase):
expected, actual, fromfile=fromfile, tofile=tofile
):
sys.stderr.write(line)
self.fail("TTX output is different from expected")
pytest.fail("TTX output is different from expected")
@classmethod
def create_font(celf):
@ -445,7 +432,7 @@ class MtiTest(unittest.TestCase):
table = mtiLib.build(f, font, tableTag=tableTag)
if tableTag is not None:
self.assertEqual(tableTag, table.tableTag)
assert tableTag == table.tableTag
tableTag = table.tableTag
# Make sure it compiles.
@ -523,4 +510,4 @@ if __name__ == "__main__":
font = MtiTest.create_font()
sys.exit(main(sys.argv[1:], font))
sys.exit(unittest.main())
sys.exit(pytest.main(sys.argv))