[CMake] running python tests

Eric Noulard eric.noulard at gmail.com
Wed Aug 25 11:11:29 EDT 2010


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")

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


More information about the CMake mailing list