# Copyright (C) 2018-2019 CEA/DEN, EDF R&D # # 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, 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 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # DIR='@CMAKE_CURRENT_SOURCE_DIR@' TESTS='@GOOD_TESTS@' REINIT_SALOME=@TEST_REINIT_SALOME@ import os import unittest import salome class MyTest(unittest.TestCase): def setUp(self): if REINIT_SALOME: salome.salome_init() def tearDown(self): if REINIT_SALOME: salome.salome_close() pass if __name__ == "__main__": tests = TESTS.split(';') for test in tests: file_name = os.path.basename(test) if os.path.isabs(test): file_path = file_name else: file_path = os.path.join(DIR, file_name) case_name = 'test_' + file_name[:-3] code = """ def func(self): with open('{}') as f: exec(f.read()) """ exec(code.format(file_path)) setattr(MyTest, case_name, func) unittest.main()