Salome HOME
Error management when a job is created with wrong parameters.
[tools/ydefx.git] / src / cpp / Test / StudyGeneralTest.cxx
index 2a3bf7572725dd82d8b7e0c2fa45e0190ae54a21..cac120e3ecac19f852040bfc73ca00a8bb4ac611 100644 (file)
@@ -100,6 +100,15 @@ void SampleTest::fullStudy()
     for(const py2cpp::PyPtr& obj : pyobjResult)
       CPPUNIT_ASSERT(obj.repr() == "['object which needs pickel protocol']");
     delete myJob;
+
+    // test a case of error
+    std::string wrongScript = "wrong 'script";
+    ydefx::PyStudyFunction wrongStudy;
+    wrongStudy.loadString(wrongScript);
+    CPPUNIT_ASSERT(!wrongStudy.isValid());
+    myJob = l.submitMonoPyJob(wrongStudy, sample, jobParams);
+    CPPUNIT_ASSERT(myJob == nullptr);
+    CPPUNIT_ASSERT(l.lastError().find("SyntaxError") != std::string::npos);
   }
   Py_Finalize();
 }