<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello,<div><br></div><div>For testing python another alternative is to create a python virtual environment and install you python package into that. Here is an example of how I have done that:</div><div><br></div><div><a href="https://github.com/SimpleITK/SimpleITK/blob/master/Wrapping/CMakeLists.txt#L97">https://github.com/SimpleITK/SimpleITK/blob/master/Wrapping/CMakeLists.txt#L97</a></div><div><br></div><div>Brad</div><div><br><div><div>On May 2, 2012, at 9:26 PM, David Cole wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Are you using "add_test" to add the tests in the CMakeLists file?<br><br>If so, you can set the test ENVIRONMENT property to set PYTHONPATH<br>when ctest executes the test. See property doc here:<br><br> &nbsp;<a href="http://cmake.org/cmake/help/v2.8.8/cmake.html#prop_test:ENVIRONMENT">http://cmake.org/cmake/help/v2.8.8/cmake.html#prop_test:ENVIRONMENT</a><br><br><br>On Wed, May 2, 2012 at 5:17 PM, Lori A. Pritchett-Sheats<br>&lt;<a href="mailto:lpritch@lanl.gov">lpritch@lanl.gov</a>&gt; wrote:<br><blockquote type="cite">I'm building Python modules using SWIG and CMake, and have run into a<br></blockquote><blockquote type="cite">problem running Python unit tests for these built modules. I can not find a<br></blockquote><blockquote type="cite">slick way to set the Python module search path when running the test. The<br></blockquote><blockquote type="cite">usual trick of setting sys.path in the scripts will not work here because I<br></blockquote><blockquote type="cite">don't know the location of the build directory. I've tried updating<br></blockquote><blockquote type="cite">PYTHONPATH in my CMakeList.txt file but that change isn't picked up when the<br></blockquote><blockquote type="cite">test is executed. I could create the unit test modules at build time using<br></blockquote><blockquote type="cite">CONFIGURE_FILE replacing @CMAKE_CURRENT_BINARY_DIR@ in a sys.path line, but<br></blockquote><blockquote type="cite">that seems heavy-handed. Has anyone else run into this problem and found<br></blockquote><blockquote type="cite">better a solution?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">--<br></blockquote><blockquote type="cite">Lori A. Pritchett-Sheats, PhD.<br></blockquote><blockquote type="cite">CCS-2, Computational Physics and Methods<br></blockquote><blockquote type="cite">Office: 505-665-6675<br></blockquote><blockquote type="cite">Fax: 505-665-4972<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Los Alamos National Laboratory<br></blockquote><blockquote type="cite">P.O. Box 1663<br></blockquote><blockquote type="cite">MS D413<br></blockquote><blockquote type="cite">Los Alamos, NM 87544<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">--<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Powered by <a href="http://www.kitware.com">www.kitware.com</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Visit other Kitware open-source projects at<br></blockquote><blockquote type="cite"><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Please keep messages on-topic and check the CMake FAQ at:<br></blockquote><blockquote type="cite"><a href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Follow this link to subscribe/unsubscribe:<br></blockquote><blockquote type="cite"><a href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote>--<br><br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a><br></div></blockquote></div><br><div>
<span class="Apple-style-span" style="font-size: 12px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">========================================================</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Bradley Lowekamp<span class="Apple-converted-space">&nbsp;</span><span class="Apple-converted-space">&nbsp;</span></font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Medical Science and Computing for</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Office of High Performance Computing and Communications</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">National Library of Medicine<span class="Apple-converted-space">&nbsp;</span></font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; "><a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a></font></p><br class="Apple-interchange-newline"></span></div></span><br class="Apple-interchange-newline">
</div>
<br></div></body></html>