Skip to content

Commit

Permalink
Replace deprecated unittest.makeSuite()
Browse files Browse the repository at this point in the history
The function has been deprecated in Python 3.11 and will be removed from
the upcoming Python 3.13.

See: https://docs.python.org/3.13/whatsnew/3.13.html#unittest
  • Loading branch information
penguinpee authored and fbergmann committed Apr 23, 2024
1 parent 6f35dde commit ec444e9
Show file tree
Hide file tree
Showing 119 changed files with 120 additions and 119 deletions.
3 changes: 2 additions & 1 deletion src/bindings/python/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

def suite():
suite = unittest.TestSuite()
loader = unittest.TestLoader()
cwd = os.getcwd()
sys.path.append(cwd)
os.chdir(test_basedir + '/..')
Expand All @@ -52,7 +53,7 @@ def suite():
module_name = re.compile(r"\.py$").sub('',os.path.basename(file))
module = __import__(module_name)
class_name = getattr(module, module_name)
suite.addTest(unittest.makeSuite(class_name))
suite.addTest(loader.loadTestsFromTestCase(class_name))
return suite

if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def test_ModelHistory_copyConstructor(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestAnnotationCopyAndClone))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestAnnotationCopyAndClone))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/annotation/TestCVTerms.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_CVTerm_set_get(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestCVTerms))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestCVTerms))

return suite

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_CVTerm_setModelQualifierType(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestCVTerms_newSetters))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestCVTerms_newSetters))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/annotation/TestDate_newSetters.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def test_Date_setYear(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestDate_newSetters))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestDate_newSetters))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/annotation/TestL3ModelHistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def test_L3ModelHistory_parseModelHistory_Model(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestL3ModelHistory))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestL3ModelHistory))

return suite

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_ModelCreator_setOrganization(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestModelCreator_newSetters))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestModelCreator_newSetters))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/annotation/TestModelHistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def test_ModelHistory_setModifiedDate(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestModelHistory))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestModelHistory))

return suite

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def test_ModelHistory_setModifiedDate2(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestModelHistory_newSetters))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestModelHistory_newSetters))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/annotation/TestRDFAnnotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ def test_RDFAnnotation_testMissingMetaId(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestRDFAnnotation))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestRDFAnnotation))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/annotation/TestRDFAnnotation2.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def test_RDFAnnotation2_modelWithHistoryWithCharacterReference(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestRDFAnnotation2))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestRDFAnnotation2))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/annotation/TestRDFAnnotationC.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def test_RDFAnnotation_C_parseModelHistory(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestRDFAnnotationC))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestRDFAnnotationC))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/annotation/TestValidation.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_Validation_ModelHistory3(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestValidation))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestValidation))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/math/TestASTNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ def test_ASTNode_units(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestASTNode))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestASTNode))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/math/TestL3FormulaParserC.py
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ def test_SBML_C_parseL3Formula_unitssettings(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestL3FormulaParserC))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestL3FormulaParserC))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/math/TestMathReadFromFile1.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_read_MathML_1(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestMathReadFromFile1))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestMathReadFromFile1))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/math/TestMathReadFromFile2.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_read_MathML_2(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestMathReadFromFile2))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestMathReadFromFile2))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/math/TestReadMathML.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ def test_element_xor(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestReadMathML))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestReadMathML))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/math/TestValidASTNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def test_ValidASTNode_unary(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestValidASTNode))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestValidASTNode))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/math/TestWriteMathML.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ def test_MathMLFormatter_sin(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestWriteMathML))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestWriteMathML))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestAlgebraicRule.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_AlgebraicRule_free_NULL(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestAlgebraicRule))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestAlgebraicRule))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestAncestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ def test_Unit_ancestor_create_model(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestAncestor))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestAncestor))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestAssignmentRule.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def test_AssignmentRule_setVariable(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestAssignmentRule))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestAssignmentRule))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestCompartment.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def test_Compartment_unsetVolume(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestCompartment))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestCompartment))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestCompartmentType.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test_CompartmentType_unsetName(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestCompartmentType))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestCompartmentType))

return suite

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def test_CompartmentType_setName3(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestCompartmentType_newSetters))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestCompartmentType_newSetters))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestCompartmentVolumeRule.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_CompartmentVolumeRule_setCompartment(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestCompartmentVolumeRule))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestCompartmentVolumeRule))

return suite

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def test_Compartment_setVolume2(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestCompartment_newSetters))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestCompartment_newSetters))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestConsistencyChecks.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_consistency_checks(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestConsistencyChecks))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestConsistencyChecks))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestConstraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_Constraint_setMessage(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestConstraint))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestConstraint))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestConstraint_newSetters.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_Constraint_setMessage2(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestConstraint_newSetters))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestConstraint_newSetters))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestCopyAndClone.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ def test_Unit_copyConstructor(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestCopyAndClone))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestCopyAndClone))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestDelay.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def test_Delay_setMath2(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestDelay))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestDelay))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestEvent.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def test_Event_setUseValuesFromTriggerTime(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestEvent))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestEvent))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestEventAssignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_EventAssignment_setVariable(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestEventAssignment))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestEventAssignment))

return suite

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_EventAssignment_setVariable2(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestEventAssignment_newSetters))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestEventAssignment_newSetters))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestEvent_newSetters.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def test_Event_setUseValuesFromTriggerTime2(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestEvent_newSetters))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestEvent_newSetters))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestFunctionDefinition.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def test_FunctionDefinition_setName(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestFunctionDefinition))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestFunctionDefinition))

return suite

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_FunctionDefinition_setName3(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestFunctionDefinition_newSetters))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestFunctionDefinition_newSetters))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestGetMultipleObjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def test_GetMultipleObjects_noUnits(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestGetMultipleObjects))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestGetMultipleObjects))

return suite

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/python/test/sbml/TestInitialAssignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_InitialAssignment_setSymbol(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestInitialAssignment))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestInitialAssignment))

return suite

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_InitialAssignment_setSymbol2(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestInitialAssignment_newSetters))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestInitialAssignment_newSetters))

return suite

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1621,7 +1621,7 @@ def test_internal_consistency_check_99925(self):

def suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestInternalConsistencyChecks))
suite.addTest(unittest.TestLoader.loadTestsFromTestCase(TestInternalConsistencyChecks))

return suite

Expand Down
Loading

0 comments on commit ec444e9

Please sign in to comment.