COMP: Label wrapped tests correctly and report the limited-API setting - #6849
Conversation
|
itk_python_add_test reaches itk_add_test, which labels a test with
${itk-module}. That variable is not set in the wrapping test scope, so
every Python test inherited whichever module was configured last.
The effect was that "ctest -L ITKVtkGlue" and a name regex selected
different sets, each of which happened to contain eight tests.
ITK_USE_PYTHON_LIMITED_API auto-enables from the interpreter version, so not passing it does not mean OFF. Print the value and where it came from.
2d44148 to
c7c9d43
Compare
Two build-UX fixes that apply to every wrapped module, split out of the ITKVtkGlue-specific work in #6848. Both come from independent Windows validation of #6715.
ctest -L ITKVtkGluewent from 8 tests to 11 here.ITK_USE_PYTHON_LIMITED_APIvalue is printed, since it auto-enables by interpreter version.1. Wrapped tests were labelled with the wrong module
itk_python_add_testdelegates toitk_add_test, which labels a test with${itk-module}. That variable is not set in theWrapping/Modules/<Name>/testscope, so every Python test inherited whichever module happened to be configured last — in this build,ITKFFTImageFilterInit:That was true of every Python test in the build, not just one module's.
The visible symptom is that the two obvious selectors disagree while both returning the same count, which hides the problem:
Union is 11. Fixed by setting
itk-modulebefore the wrapping test directory is added, soitk_add_testlabels correctly for all modules.Measured before and after, same configuration:
ctest -L ITKVtkGlue2. Print the resolved limited-API setting
ITK_USE_PYTHON_LIMITED_APIauto-enables from the interpreter version inITKSetPython3Vars.cmake, so "I did not pass it" does not mean OFF. Nothing reported the resolved value, which made it easy to believe a build was testing the opposite mode from the one it was in.What was dropped from this PR, and why
The same Windows report described a third issue: with
ITK_BUILD_DEFAULT_MODULES=OFF,-DModule_ITKTestKernel=ONwithout the:BOOLtype leaves the entryINTERNAL=OFF, the dependent C++ tests are never created, and ctest reports 100% pass on what remains.I wrote a configure-time warning for it and then removed it, because I could not reproduce the underlying condition on current
main. In a build withITK_BUILD_DEFAULT_MODULES=OFFandModule_ITKVtkGlue=ON, the C++ tests register whether or notModule_ITKTestKernel:BOOL=ONis passed. A first attempt at the warning also fired on every dependency-pulled module, which legitimately builds no tests.Rather than ship a diagnostic for a state I cannot demonstrate, it is left out. If someone can produce a configuration where the tests silently vanish, that belongs in its own issue with the exact flags.
Verification
macOS arm64, VTK 9.6.2, Python 3.13.9:
pre-commit run --all-filesexits 0.