-# Copyright (C) 2014-2020 CEA/DEN, EDF R&D
+# Copyright (C) 2014-2024 CEA, EDF
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
reffile = ""
def setUp(self):
- salome.salome_close()
-
- salome.salome_init(self.testfile, embedded=1)
+ salome.standalone()
+ salome.salome_init(self.testfile, embedded=1, forced=True)
myStudyName = salome.myStudy._get_Name()
self.session = salome.naming_service.Resolve('/Kernel/Session')
self.session.emitMessage("connect_to_study")
self.session.setActiveDocument(self.partSet)
self.session.finishOperation()
+ # Check that the features are not in error
+ Part_1_doc = aPart.partDoc()
+
+ model.checkFeaturesValidity(Part_1_doc)
# check reference data
exec(open(self.reffile, "rb").read(), globals(), aPartsList)
if len(sys.argv) > 2:
TestHDF.reffile = sys.argv[2]
if len(sys.argv) > 3:
- salomePortFile = sys.argv[3]
- if len(sys.argv) > 4:
- errFile = open(sys.argv[4], 'w')
+ errFile = open(sys.argv[3], 'w')
+ else:
+ # to ease debugging, display the log in embedded python console if no log file is provided
+ # when calling salome in command line for instance
+ # runSalome.py --splash 0 test_hdf.py args:BearingSeparator.hdf,BearingSeparator.py
+ errFile = None
aTest = unittest.TestLoader().loadTestsFromTestCase(TestHDF)
unittest.TextTestRunner(stream=errFile).run(aTest)
- errFile.close()
-
- # close Salome GUI
- port = salome_utils.getPortNumber()
- proc = subprocess.Popen(["killSalomeWithPort.py", "{}".format(port)])
+ if errFile:
+ errFile.close()
- try:
- os.remove(salomePortFile)
- except:
- print("Cannot remove file", file=f)
+ # Quit SALOME the clean way
+ sys.exit()