Salome HOME
[EDF27816] : Get rid of SALOME session for 3 last tests (YacsLoader, YacsLoader_Swig...
[modules/yacs.git] / src / yacsloader_swig / Test / testExec.py
index eac472abb76af52319cae0ea11d0b8b4f5308427..6ed7c4ad8c75dcdbd9381480a4d9a642b628bba1 100755 (executable)
@@ -185,11 +185,20 @@ class TestExec(unittest.TestCase):
     pass
 
 if __name__ == '__main__':
-  dir_test = tempfile.mkdtemp(suffix=".yacstest")
-  file_test = os.path.join(dir_test,"UnitTestsResult")
-  with open(file_test, 'a') as f:
-        f.write("  --- TEST src/yacsloader: testExec.py\n")
-        suite = unittest.makeSuite(TestExec)
-        result = unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
-
+  import salome
+  import NamingService
+  import os
+  import subprocess
+  salome.salome_init()
+  ior = NamingService.NamingService.IOROfNS()
+  p = subprocess.Popen(["../yacsloader/echoSrv",ior])
+  import time
+  time.sleep(3)
+  with tempfile.TemporaryDirectory(suffix=".yacstest") as dir_test:
+    file_test = os.path.join(dir_test,"UnitTestsResult")
+    with open(file_test, 'a') as f:
+      f.write("  --- TEST src/yacsloader: testExec.py\n")
+      suite = unittest.makeSuite(TestExec)
+      result = unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
+  p.terminate()
   sys.exit(not result.wasSuccessful())