@@ -188,12 +188,20 @@ function(itk_python_add_test)
188
188
else ()
189
189
set (itk_wrap_python_binary_dir "${ITK_BINARY_DIR} /Wrapping/Generators/Python" )
190
190
endif ()
191
+ # itk_wrap_python_binary_dir *MUST* contain the WrapITK.pth file
192
+ set (WrapITK_PTH_FILE "${itk_wrap_python_binary_dir} /WrapITK.pth" )
193
+ if (NOT EXISTS ${WrapITK_PTH_FILE} )
194
+ # Final installed version of ITK will leverage the WrapITK.pth paths, so
195
+ # the test environment should also use those same paths.
196
+ message (FATAL_ERROR "The sys.path must be updated with the WrapITK.pth file content." )
197
+ endif ()
198
+ unset (WrapITK_PTH_FILE)
191
199
192
200
if (CMAKE_CONFIGURATION_TYPES )
193
201
itk_add_test(NAME ${PYTHON_ADD_TEST_NAME}
194
202
COMMAND itkTestDriver
195
203
--add-before-env PYTHONPATH "${itk_wrap_python_binary_dir} /$<CONFIG>" # parent directory of the itk package
196
- --add-before-env PYTHONPATH "${itk_wrap_python_binary_dir} /$<CONFIG>/itk" # directory of the itk package ( contains __init__.py)
204
+ # NOT NEEDED --add-before-env PYTHONPATH "${itk_wrap_python_binary_dir}/$<CONFIG>/itk" # directory of the itk package ( contains __init__.py)
197
205
--add-before-env PYTHONPATH "${itk_wrap_python_binary_dir} /$<CONFIG>/itk/conf" # directory of the itkConfig module
198
206
--add-before-env PYTHONPATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /$<CONFIG>" # directory of shared libraries + swig artifacts
199
207
--add-before-libpath "${CMAKE_LIBRARY_OUTPUT_DIRECTORY} /$<CONFIG>" # itk non-wrapping shared libs
@@ -207,7 +215,7 @@ function(itk_python_add_test)
207
215
itk_add_test(NAME ${PYTHON_ADD_TEST_NAME}
208
216
COMMAND itkTestDriver
209
217
--add-before-env PYTHONPATH "${itk_wrap_python_binary_dir} " # parent directory of the itk package
210
- --add-before-env PYTHONPATH "${itk_wrap_python_binary_dir} /itk" # directory of the itk package ( contains __init__.py)
218
+ # NOT NEEDED --add-before-env PYTHONPATH "${itk_wrap_python_binary_dir}/itk" # directory of the itk package ( contains __init__.py)
211
219
--add-before-env PYTHONPATH "${itk_wrap_python_binary_dir} /itk/conf" # directory of the itkConfig module
212
220
--add-before-env PYTHONPATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY} " # directory of shared libraries + swig artifacts
213
221
--add-before-libpath "${CMAKE_LIBRARY_OUTPUT_DIRECTORY} " # itk non-wrapping shared libs
0 commit comments