X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fsalomeloader%2FtestSalomeLoader.py.in;h=8cb5b3d8a3b53768982986ea940e9c3cc9a2e5cb;hb=255150e4eec79294bbd06c7c464f309b4a264960;hp=82ef4a7009b9a482efdc8ef0b2ce872660d5f87b;hpb=f3b2b68ffecc5033287a7a255c8507f8989fb87f;p=modules%2Fyacs.git diff --git a/src/salomeloader/testSalomeLoader.py.in b/src/salomeloader/testSalomeLoader.py.in index 82ef4a700..8cb5b3d8a 100755 --- a/src/salomeloader/testSalomeLoader.py.in +++ b/src/salomeloader/testSalomeLoader.py.in @@ -1,10 +1,10 @@ -#!/usr/bin/env python -# Copyright (C) 2006-2013 CEA/DEN, EDF R&D +#!/usr/bin/env python3 +# Copyright (C) 2006-2023 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either -# version 2.1 of the License. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,16 +21,15 @@ import sys import os -# --- top_builddir is used in make check -# --- top_srcdir is used in make distcheck +# --- CMAKE_BINARY_DIR is used in make test -sys.path.insert(0,"@srcdir@") -sys.path.insert(0,"@top_builddir@/src/engine_swig") -sys.path.insert(0,"@top_builddir@/src/runtime_swig") -sys.path.insert(0,"@top_builddir@/src/engine_swig/.libs") -sys.path.insert(0,"@top_builddir@/src/runtime_swig/.libs") -sys.path.insert(0,"@top_srcdir@/src/engine_swig") -sys.path.insert(0,"@top_srcdir@/src/runtime_swig") +sys.path.insert(0,"@CMAKE_CURRENT_SOURCE_DIR@") +sys.path.insert(0,"@CMAKE_BINARY_DIR@/src/engine_swig") +sys.path.insert(0,"@CMAKE_BINARY_DIR@/src/runtime_swig") +sys.path.insert(0,"@CMAKE_BINARY_DIR@/src/engine_swig/.libs") +sys.path.insert(0,"@CMAKE_BINARY_DIR@/src/runtime_swig/.libs") +sys.path.insert(0,"@CMAKE_SOURCE_DIR@/src/engine_swig") +sys.path.insert(0,"@CMAKE_SOURCE_DIR@/src/runtime_swig") import unittest import pilot @@ -44,39 +43,38 @@ class TestSalomeLoader(unittest.TestCase): def test1(self): """test GeomGraph.xml""" - p= self.loader.load(os.path.join("@srcdir@","samples","GeomGraph.xml")) + p= self.loader.load(os.path.join("@CMAKE_CURRENT_SOURCE_DIR@","samples","GeomGraph.xml")) p.saveSchema("tata.xml") def test2(self): """test GeomGraphGates_py.xml""" - p= self.loader.load(os.path.join("@srcdir@","samples","GeomGraphGates_py.xml")) + p= self.loader.load(os.path.join("@CMAKE_CURRENT_SOURCE_DIR@","samples","GeomGraphGates_py.xml")) p.saveSchema("tata.xml") def test3(self): """test GeomGraphGates.xml""" - p= self.loader.load(os.path.join("@srcdir@","samples","GeomGraphGates.xml")) + p= self.loader.load(os.path.join("@CMAKE_CURRENT_SOURCE_DIR@","samples","GeomGraphGates.xml")) p.saveSchema("tata.xml") def test4(self): """test GeomGraph_py.xml""" - p= self.loader.load(os.path.join("@srcdir@","samples","GeomGraph_py.xml")) + p= self.loader.load(os.path.join("@CMAKE_CURRENT_SOURCE_DIR@","samples","GeomGraph_py.xml")) p.saveSchema("tata.xml") def test5(self): """test Graph_couronne.xml""" - p= self.loader.load(os.path.join("@srcdir@","samples","Graph_couronne.xml")) + p= self.loader.load(os.path.join("@CMAKE_CURRENT_SOURCE_DIR@","samples","Graph_couronne.xml")) p.saveSchema("tata.xml") def test6(self): """test testvisu20.xml""" - p= self.loader.load(os.path.join("@srcdir@","samples","testvisu20.xml")) + p= self.loader.load(os.path.join("@CMAKE_CURRENT_SOURCE_DIR@","samples","testvisu20.xml")) p.saveSchema("tata.xml") U = os.getenv('USER') -f=open("/tmp/" + U + "/UnitTestsResult", 'a') -f.write(" --- TEST src/salomeloader: testSalomeLoader.py\n") -suite = unittest.makeSuite(TestSalomeLoader) -result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite) -f.close() +with open("/tmp/" + U + "/UnitTestsResult", 'a') as f: + f.write(" --- TEST src/salomeloader: testSalomeLoader.py\n") + suite = unittest.makeSuite(TestSalomeLoader) + result=unittest.TextTestRunner(f, descriptions=1, verbosity=1).run(suite) sys.exit(not result.wasSuccessful())