Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 912945833a20ee1094254e5bebba28966a6e1d2a 1 parent 059eec7
@jcfr jcfr authored
View
15 CMake/SlicerMacroBuildScriptedModule.cmake
@@ -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()
View
1  Extensions/Testing/ScriptedLoadableExtensionTemplate/ScriptedLoadableModuleTemplate/CMakeLists.txt
@@ -14,6 +14,7 @@ slicerMacroBuildScriptedModule(
NAME ${MODULE_NAME}
SCRIPTS ${MODULE_PYTHON_SCRIPTS}
RESOURCES ${MODULE_PYTHON_RESOURCES}
+ WITH_GENERIC_TESTS
)
#-----------------------------------------------------------------------------
View
15 ...s/Testing/ScriptedLoadableExtensionTemplate/ScriptedLoadableModuleTemplate/Testing/Python/CMakeLists.txt
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.