Salome HOME
projects
/
modules
/
shaper.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updated copyright comment
[modules/shaper.git]
/
test.hdfs
/
test_hdf.py
diff --git
a/test.hdfs/test_hdf.py
b/test.hdfs/test_hdf.py
index 1ae49db9cd25b02d046d1ac666a1ce8c25ad7157..91cfd73decd4a666f787f8517d66da649da221e6 100644
(file)
--- a/
test.hdfs/test_hdf.py
+++ b/
test.hdfs/test_hdf.py
@@
-1,4
+1,4
@@
-# Copyright (C) 2014-20
19 CEA/DEN, EDF R&D
+# Copyright (C) 2014-20
24 CEA, EDF
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@
-32,13
+32,8
@@
class TestHDF(unittest.TestCase):
reffile = ""
def setUp(self):
reffile = ""
def setUp(self):
- salome.salome_close()
-
- # leave file name only (trim path and extension)
- fileName = os.path.basename(self.testfile)
- self.reffile = self.reffile + "/" + os.path.splitext(fileName)[0] + ".py"
-
- 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")
myStudyName = salome.myStudy._get_Name()
self.session = salome.naming_service.Resolve('/Kernel/Session')
self.session.emitMessage("connect_to_study")
@@
-65,6
+60,14
@@
class TestHDF(unittest.TestCase):
aPartFeature = PartSetAPI.PartSetAPI_Part(self.partSet.currentFeature(True))
aPartsList["Part_{}".format(aPartIndex+1)] = aPartFeature
aPartFeature = PartSetAPI.PartSetAPI_Part(self.partSet.currentFeature(True))
aPartsList["Part_{}".format(aPartIndex+1)] = aPartFeature
+ self.session.startOperation()
+ 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)
# check reference data
exec(open(self.reffile, "rb").read(), globals(), aPartsList)
@@
-73,23
+76,19
@@
if __name__ == "__main__":
if len(sys.argv) > 1:
TestHDF.testfile = sys.argv[1]
if len(sys.argv) > 2:
if len(sys.argv) > 1:
TestHDF.testfile = sys.argv[1]
if len(sys.argv) > 2:
-
salomePortF
ile = sys.argv[2]
+
TestHDF.reff
ile = sys.argv[2]
if len(sys.argv) > 3:
errFile = open(sys.argv[3], 'w')
if len(sys.argv) > 3:
errFile = open(sys.argv[3], 'w')
- if len(sys.argv) > 4:
- salomeKernelDir = sys.argv[4]
- if len(sys.argv) > 5:
- TestHDF.reffile = sys.argv[5]
+ 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)
aTest = unittest.TestLoader().loadTestsFromTestCase(TestHDF)
unittest.TextTestRunner(stream=errFile).run(aTest)
- errFile.close()
-
- # close Salome GUI
- port = salome_utils.getPortNumber()
- proc = subprocess.Popen([salomeKernelDir + "/bin/salome/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()