Environment
- OS Version: Any
- Source or binary build?
Source @ 2b66954
Description
- Expected behavior: Tests execute successfully
- Actual behavior:
basic_TEST.py can't find gz.msgs10 to import
Steps to reproduce
mkdir -p build && cd build && cmake .. && make
make install DESTDIR=/tmp/foobar
ctest
Output
The following tests FAILED:
13 - basic_TEST.py (Failed)
The test sets PYTHONPATH based on where it anticipates the Python module will be installed to, however:
- In general, a developer can typically invoke
ctest prior to installing a project and it should use artifacts from the build directories for testing. The Python tests in gz-math behave like this, for example.
- The existing prediction doesn't work when
GZ_PYTHON_INSTALL_PATH is changed, perhaps by setting USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION=ON.
- When
DESTDIR is used to direct make where to install files instead of CMAKE_INSTALL_PREFIX, the final target directory isn't known to ctest at all.
- By overriding
PYTHONPATH unconditionally, it's not possible to set PYTHONPATH manually prior to invoking ctest. Without resorting to using CMAKE_INSTALL_PREFIX or modifying the cmake, it's impossible to get the test to pass.
Note that DESTDIR is the installation root mechanism used in both Debian and RPM builds, but colcon uses CMAKE_INSTALL_PREFIX because DESTDIR is a Makefile concept and doesn't typically work on Windows.
Environment
Source @ 2b66954
Description
basic_TEST.pycan't findgz.msgs10to importSteps to reproduce
mkdir -p build && cd build && cmake .. && makemake install DESTDIR=/tmp/foobarctestOutput
The test sets
PYTHONPATHbased on where it anticipates the Python module will be installed to, however:ctestprior to installing a project and it should use artifacts from the build directories for testing. The Python tests in gz-math behave like this, for example.GZ_PYTHON_INSTALL_PATHis changed, perhaps by settingUSE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION=ON.DESTDIRis used to directmakewhere to install files instead ofCMAKE_INSTALL_PREFIX, the final target directory isn't known toctestat all.PYTHONPATHunconditionally, it's not possible to setPYTHONPATHmanually prior to invokingctest. Without resorting to usingCMAKE_INSTALL_PREFIXor modifying the cmake, it's impossible to get the test to pass.Note that
DESTDIRis the installation root mechanism used in both Debian and RPM builds, but colcon usesCMAKE_INSTALL_PREFIXbecauseDESTDIRis a Makefile concept and doesn't typically work on Windows.