]> SALOME platform Git repositories - modules/yacs.git/blob - src/yacsloader_swig/Test/testYacsLoaderSwig.py
Salome HOME
[EDF30875] : mistype leading to a non activation of squeeze mode
[modules/yacs.git] / src / yacsloader_swig / Test / testYacsLoaderSwig.py
1 #!/usr/bin/env python3
2 # Copyright (C) 2023-2024  CEA, EDF
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 import salome
22 import NamingService
23 import os
24 import sys
25 import subprocess
26 salome.salome_init()
27 ior = NamingService.NamingService.IOROfNS()
28
29 from testEdit import TestEdit
30 from testExec import TestExec
31 from testLoader import TestLoader
32 from testSave import TestSave
33
34 p = subprocess.Popen(["../yacsloader/echoSrv",ior])
35 import time
36 time.sleep(3)
37 import tempfile
38 import unittest
39 zezeResult = True
40 zeResultStr = []
41 with tempfile.TemporaryDirectory(suffix=".yacstest") as dir_test:
42   file_test = os.path.join(dir_test,"UnitTestsResult")
43   with open(file_test, 'a') as f:
44       f.write("  --- TEST src/yacsloader: testLoader.py\n")
45       for zeTest in [TestEdit,TestExec,TestLoader,TestSave]:
46         suite = unittest.makeSuite(zeTest)
47         result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
48         zeResult = result.wasSuccessful()
49         zezeResult = zeResult and zezeResult
50         zeResultStr.append( "Result for {} is {}".format(str(zeTest),zeResult) )
51 p.terminate()
52 zeResultStr.append("So at the end the result is {}".format(zezeResult))
53 print("\n".join(zeResultStr))
54 returnCode = int( not zezeResult )
55 print("Return code is {}".format( returnCode ))
56 sys.exit(returnCode)