From c54b939576d604f240d652de350def810f6f4748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 13 Mar 2024 16:55:53 +0100 Subject: [PATCH] Avoid usage of unittest.makeSuite, removed from Python 3.13 Patch generated by: sed -i 's/unittest.makeSuite/unittest.defaultTestLoader.loadTestsFromTestCase/g' $(grep -rl makeSuite) --- ext_tests.py | 2 +- tests.py | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ext_tests.py b/ext_tests.py index 1fd8d8f..94fef6c 100755 --- a/ext_tests.py +++ b/ext_tests.py @@ -98,7 +98,7 @@ def get_suite(filenames): # we use the (potentially) patched version of json.load here tests = jsonpatch.json.load(f) cls = make_test_case(tests) - suite.addTest(unittest.makeSuite(cls)) + suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(cls)) return suite diff --git a/tests.py b/tests.py index d9eea92..d9210ee 100755 --- a/tests.py +++ b/tests.py @@ -1048,18 +1048,18 @@ class JsonPatch(jsonpatch.JsonPatch): def get_suite(): suite = unittest.TestSuite() suite.addTest(doctest.DocTestSuite(jsonpatch)) - suite.addTest(unittest.makeSuite(ApplyPatchTestCase)) - suite.addTest(unittest.makeSuite(EqualityTestCase)) - suite.addTest(unittest.makeSuite(MakePatchTestCase)) - suite.addTest(unittest.makeSuite(ListTests)) - suite.addTest(unittest.makeSuite(InvalidInputTests)) - suite.addTest(unittest.makeSuite(ConflictTests)) - suite.addTest(unittest.makeSuite(OptimizationTests)) - suite.addTest(unittest.makeSuite(JsonPointerTests)) - suite.addTest(unittest.makeSuite(JsonPatchCreationTest)) - suite.addTest(unittest.makeSuite(UtilityMethodTests)) - suite.addTest(unittest.makeSuite(CustomJsonPointerTests)) - suite.addTest(unittest.makeSuite(CustomOperationTests)) + suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(ApplyPatchTestCase)) + suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(EqualityTestCase)) + suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(MakePatchTestCase)) + suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(ListTests)) + suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(InvalidInputTests)) + suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(ConflictTests)) + suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(OptimizationTests)) + suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(JsonPointerTests)) + suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(JsonPatchCreationTest)) + suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(UtilityMethodTests)) + suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(CustomJsonPointerTests)) + suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(CustomOperationTests)) return suite