.. _dune_python_add_test:

dune_python_add_test
====================

.. cmake_function:: dune_python_add_test

   .. cmake_param:: COMMAND
      :multi:
      :required:

      The command to run. It will be executed during :code:`make test_python`
      and during `ctest`.

      .. note::

         If your testing command involves an invocation of the python
         interpreter you should use :code:`${PYTHON_EXECUTABLE}` for that.
         Also calling python executables through :code:`-m` is generally to
         be favored, e.g. :code:`${PYTHON_EXECUTABLE} -m pytest` instead of
         :code:`py.test`.

   .. cmake_param:: WORKING_DIRECTORY
      :single:
      :argname: dir

      The working directory of the command. Defaults to
      the current build directory.

   .. cmake_param:: NAME
      :single:

      A name to identify this test in ctest. Names must be unique throughout
      the project. If omitted, defaults to mangling of the command.

   Integrates a python testing framework command into the Dune
   build system. Added commands are run, when the target
   :code:`test_python` is built and during :code:`ctest`.

