Permalink
Browse files

ENH: Add option WITH_GENERIC_TESTS to slicerMacroBuildScriptedModule

Instead of manually invoking "SlicerMacroConfigureGenericPythonModuleTests"
and then adding the associated scripts, specifying this new option
will auto-magically add the generic test.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21763 3bd1e089-480b-0410-8dfb-8563597acbee
  • Loading branch information...
1 parent 059eec7 commit 912945833a20ee1094254e5bebba28966a6e1d2a @jcfr jcfr committed Feb 22, 2013
@@ -20,6 +20,7 @@
macro(slicerMacroBuildScriptedModule)
set(options
+ WITH_GENERIC_TESTS
WITH_SUBDIR
VERBOSE
)
@@ -87,5 +88,19 @@ macro(slicerMacroBuildScriptedModule)
${_no_install_subdir_option}
)
+ if(BUILD_TESTING AND MY_SLICER_WITH_GENERIC_TESTS)
+ set(_generic_unitest_scripts)
+ SlicerMacroConfigureGenericPythonModuleTests("${MY_SLICER_NAME}" _generic_unitest_scripts)
+
+ foreach(script_name ${_generic_unitest_scripts})
+ slicer_add_python_unittest(
+ SCRIPT ${script_name}
+ SLICER_ARGS --no-main-window --disable-cli-modules --disable-loadable-modules
+ --additional-module-path ${CMAKE_BINARY_DIR}/${Slicer_QTSCRIPTEDMODULES_LIB_DIR}
+ TESTNAME_PREFIX nomainwindow_
+ )
+ endforeach()
+ endif()
+
endmacro()
@@ -14,6 +14,7 @@ slicerMacroBuildScriptedModule(
NAME ${MODULE_NAME}
SCRIPTS ${MODULE_PYTHON_SCRIPTS}
RESOURCES ${MODULE_PYTHON_RESOURCES}
+ WITH_GENERIC_TESTS
)
#-----------------------------------------------------------------------------
@@ -1,15 +1,2 @@
-#-----------------------------------------------------------------------------
-set(KIT_UNITTEST_SCRIPTS)
-SlicerMacroConfigureGenericPythonModuleTests("${MODULE_NAME}" KIT_UNITTEST_SCRIPTS)
-
-#-----------------------------------------------------------------------------
-foreach(script_name ${KIT_UNITTEST_SCRIPTS})
- slicer_add_python_unittest(
- SCRIPT ${script_name}
- SLICER_ARGS --no-main-window --disable-cli-modules --disable-loadable-modules
- --additional-module-path ${CMAKE_BINARY_DIR}/${Slicer_QTSCRIPTEDMODULES_LIB_DIR}
- TESTNAME_PREFIX nomainwindow_
- )
-endforeach()
-
+#slicer_add_python_unittest(SCRIPT ${MODULE_NAME}ModuleTest.py)

0 comments on commit 9129458

Please sign in to comment.