Salome HOME
8fae940ebcfcf5cd549eeb8a2c5b414321d9e8cd
[modules/yacs.git] / src / salomeloader / testSalomeLoader.py.in
1 #!/usr/bin/env python3
2 # Copyright (C) 2006-2020  CEA/DEN, EDF R&D
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 sys
22 import os
23
24 # --- CMAKE_BINARY_DIR is used in make test
25
26 sys.path.insert(0,"@CMAKE_CURRENT_SOURCE_DIR@")
27 sys.path.insert(0,"@CMAKE_BINARY_DIR@/src/engine_swig")
28 sys.path.insert(0,"@CMAKE_BINARY_DIR@/src/runtime_swig")
29 sys.path.insert(0,"@CMAKE_BINARY_DIR@/src/engine_swig/.libs")
30 sys.path.insert(0,"@CMAKE_BINARY_DIR@/src/runtime_swig/.libs")
31 sys.path.insert(0,"@CMAKE_SOURCE_DIR@/src/engine_swig")
32 sys.path.insert(0,"@CMAKE_SOURCE_DIR@/src/runtime_swig")
33
34 import unittest
35 import pilot
36 import SALOMERuntime
37 import salomeloader
38
39 class TestSalomeLoader(unittest.TestCase):
40   def setUp(self):
41     SALOMERuntime.RuntimeSALOME_setRuntime()
42     self.loader=salomeloader.SalomeLoader()
43
44   def test1(self):
45     """test GeomGraph.xml"""
46     p= self.loader.load(os.path.join("@CMAKE_CURRENT_SOURCE_DIR@","samples","GeomGraph.xml"))
47     p.saveSchema("tata.xml")
48
49   def test2(self):
50     """test GeomGraphGates_py.xml"""
51     p= self.loader.load(os.path.join("@CMAKE_CURRENT_SOURCE_DIR@","samples","GeomGraphGates_py.xml"))
52     p.saveSchema("tata.xml")
53
54   def test3(self):
55     """test GeomGraphGates.xml"""
56     p= self.loader.load(os.path.join("@CMAKE_CURRENT_SOURCE_DIR@","samples","GeomGraphGates.xml"))
57     p.saveSchema("tata.xml")
58
59   def test4(self):
60     """test GeomGraph_py.xml"""
61     p= self.loader.load(os.path.join("@CMAKE_CURRENT_SOURCE_DIR@","samples","GeomGraph_py.xml"))
62     p.saveSchema("tata.xml")
63
64   def test5(self):
65     """test Graph_couronne.xml"""
66     p= self.loader.load(os.path.join("@CMAKE_CURRENT_SOURCE_DIR@","samples","Graph_couronne.xml"))
67     p.saveSchema("tata.xml")
68
69   def test6(self):
70     """test testvisu20.xml"""
71     p= self.loader.load(os.path.join("@CMAKE_CURRENT_SOURCE_DIR@","samples","testvisu20.xml"))
72     p.saveSchema("tata.xml")
73
74 U = os.getenv('USER')
75 with open("/tmp/" + U + "/UnitTestsResult", 'a') as f:
76   f.write("  --- TEST src/salomeloader: testSalomeLoader.py\n")
77   suite = unittest.makeSuite(TestSalomeLoader)
78   result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite)
79 sys.exit(not result.wasSuccessful())
80