def availableResources():
resManager = salome_proxy.getResourcesManager()
- params = salome_proxy.createSalomeParameters().resource_required
- params.can_launch_batch_jobs = True
- return resManager.GetFittingResources(params)
+ params = salome_proxy.createSalomeParameters()
+ params.resource_required.can_launch_batch_jobs = True
+ return resManager.GetFittingResources(params.resource_required)
result.resource_required = salome.ResourceParameters()
else:
result = pylauncher.JobParameters_cpp()
- result.resource_required = pylauncher.resourceParams()
return result
_resourceManager = None
SET(TESTFILES
test_insitu.py
test_prescript.py
+ test_default.py
)
INSTALL(FILES ${TESTFILES} DESTINATION ${LOCAL_TEST_DIR})
INSTALL(PROGRAMS runUnitTest.sh
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-python3 -m unittest test_insitu.py test_prescript.py
+python3 -m unittest test_insitu.py test_prescript.py test_default.py
ret=$?
exit $ret
--- /dev/null
+import unittest
+import os
+import time
+
+class TestYdefx(unittest.TestCase):
+ def test_errors(self):
+ """
+ Test errors in study script.
+ """
+ import pydefx
+
+ myScript = pydefx.PyScript()
+ myScript.loadString("a=5")
+ self.assertIn("not accepted statement", myScript.getErrors())
+
+ myScript.loadString("n'importe quoi!")
+ self.assertIn("SyntaxError", myScript.getErrors())
+
+ myScript.loadString("")
+ self.assertIn("Function _exec not found", myScript.getErrors())
+
+ with self.assertRaises(pydefx.pyscript.PyScriptException):
+ mySample = myScript.CreateEmptySample()
+
+ def test_availableResources(self):
+ import pydefx
+ lr = pydefx.configuration.availableResources()
+ self.assertIn('localhost', lr)
+
+if __name__ == '__main__':
+ unittest.main()
myStudy.launch()
print(myStudy.getJobState())
print(myStudy.getProgress())
+myStudy.wait()
+print(myStudy.getJobState())
+print(myStudy.getProgress())
+myStudy.getResult()
+print(myStudy.sample)
+print(myStudy.global_result)