From ea8b9b85d7fb3cd9f016096e152d224de7f308db Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Tue, 7 Mar 2023 12:00:50 +0000 Subject: [PATCH] mti_test: convert to pytest-style test module --- Tests/mtiLib/mti_test.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/Tests/mtiLib/mti_test.py b/Tests/mtiLib/mti_test.py index 302417dc2..1c9d7338a 100644 --- a/Tests/mtiLib/mti_test.py +++ b/Tests/mtiLib/mti_test.py @@ -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))