[CMake] running python tests

David Cole david.cole at kitware.com
Wed Aug 25 11:14:42 EDT 2010


On Wed, Aug 25, 2010 at 11:11 AM, Eric Noulard <eric.noulard at gmail.com>wrote:

> 2010/8/25 David Cole <david.cole at kitware.com>:
> > Show us your "add_test" call.
> > If it's a python script, execute the python interpreter and pass the
> script
> > as an arg:
> > add_test(${PYTHON_EXECUTABLE} "/full/path/to/script.py")
>
> I think you mean
>
> add_test(TestName ${PYTHON_EXECUTABLE} "/full/path/to/script.py")
>

Yes, of course. I was too hasty on that reply... Thanks for the correction.
:-)



> Another solution I'm currently using on Linux
> (don't know how it work on Windows) is to add
> this as the very first line of your script:
>
> #!/usr/bin/env python
>
> + making the script executable.
>
> Then
> add_test(TestName "/full/path/to/script.py")
> should work as well without trouble.
>
> David's solution should work on Windows too as soon as you
> find_package(PythonInterp)
>
> see
> http://docs.python.org/tutorial/interpreter.html#executable-python-scripts
> --
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100825/349af500/attachment.htm>


More information about the CMake mailing list