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