# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-SET(COMPONENT_NAME MEDCalc)
+SET(COMPONENT_NAME MEDCALC)
SET(TIMEOUT 300)
SUBDIRS(MEDCalculator)
+SUBDIRS(MEDCalc)
IF(SALOME_BUILD_GUI)
ADD_SUBDIRECTORY(gui)
- IF(SALOME_MED_WITH_QTTESTING)
+ IF(SALOME_MED_WITH_QTTESTING)
ADD_SUBDIRECTORY(test)
ENDIF()
-
+
ENDIF()
IF(SALOME_MED_ENABLE_PYTHON)
)
# Install rules
-SALOME_INSTALL_SCRIPTS(test_qttesting.py ${SALOME_MED_INSTALL_TEST}/MEDCalc)
-SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/medcalc_testutils.py ${SALOME_MED_INSTALL_TEST}/MEDCalc)
+SET(TEST_INSTALL_DIRECTORY ${SALOME_MED_INSTALL_TEST}/MEDCalc)
+
+SALOME_INSTALL_SCRIPTS(test_qttesting.py ${TEST_INSTALL_DIRECTORY})
+SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/medcalc_testutils.py ${TEST_INSTALL_DIRECTORY})
SALOME_INSTALL_SCRIPTS("${_test_scripts}" ${SALOME_INSTALL_PYTHON}/tests)
-
+
INSTALL(FILES ${_test_scenarii} DESTINATION ${SALOME_MED_INSTALL_RES_DATA}/tests/scenarios)
INSTALL(FILES ${_test_baselines} DESTINATION ${SALOME_MED_INSTALL_RES_DATA}/tests/baselines)
INSTALL(FILES ${_test_files} DESTINATION ${SALOME_MED_INSTALL_RES_DATA}/tests/medfiles)
-INSTALL(FILES CTestTestfileInstall.cmake DESTINATION ${SALOME_MED_INSTALL_TEST}/MEDCalc RENAME CTestTestfile.cmake)
+INSTALL(FILES CTestTestfileInstall.cmake
+ DESTINATION ${TEST_INSTALL_DIRECTORY}
+ RENAME CTestTestfile.cmake)
-# Copyright (C) 2015-2016 CEA/DEN, EDF R&D
+# Copyright (C) 2016 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
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-SET(COMPONENT_NAME MEDCALC)
-SET(TIMEOUT 180) # the GUI needs to start - so let some time here!
+SET(TEST_NAMES
+ test_qttesting
+)
-ADD_TEST(MEDCalcQtTesting python test_qttesting.py)
-SET_TESTS_PROPERTIES(MEDCalcQtTesting PROPERTIES LABELS "${COMPONENT_NAME}")
+FOREACH(tfile ${TEST_NAMES})
+ SET(TEST_NAME ${COMPONENT_NAME}_${tfile})
+ ADD_TEST(${TEST_NAME} python ${tfile}.py)
+ SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES
+ LABELS "${COMPONENT_NAME}"
+ TIMEOUT ${TIMEOUT}
+ )
+ENDFOREACH()
-# Copyright (C) 2011-2016 CEA/DEN, EDF R&D
+# Copyright (C) 2016 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
unittest.TestCase.__init__(self, methodName=methodName)
self._tmpDir = ""
self._removeDir = True
-
+
def setUp(self):
import tempfile
self._tmpDir = tempfile.mkdtemp(prefix="med_gui_tests_")
unittest.TestCase.tearDown(self)
if self._removeDir:
shutil.rmtree(self._tmpDir, False)
-
+
def getTestName(self):
""" Return name of the test being currently executed. """
return self.id().split(".")[-1]
Assert if not matching. """
import filecmp
from medcalc_testutils import GetBaselineDir
-
+
base_pth = os.path.join(GetBaselineDir(), basename)
gen_path = os.path.join(self._tmpDir, basename)
print base_pth, gen_path
try:
ret = filecmp.cmp(base_pth, gen_path, shallow=False)
except OSError:
+ import traceback
+ traceback.print_exc()
ret = False
if not ret:
# Keep file if comparison fails
filedata = filedata.replace("/tmp/%s" % med_file, os.path.join(GetMEDFileDir(), med_file))
with open(scen_pth2,'w') as f:
f.write(filedata)
-
+
##
## Now the tests themselves
##
# Application tests
-SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test/MEDCalculator)
+SET(TEST_INSTALL_DIRECTORY ${SALOME_MED_INSTALL_TEST}/MEDCalculator)
INSTALL(TARGETS TestMEDCalculator DESTINATION ${TEST_INSTALL_DIRECTORY})
INSTALL(FILES CTestTestfileInstall.cmake