.. _dune_python_add_test:

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

.. cmake_function:: dune_python_add_test

   .. cmake_param:: SCRIPT
      :multi:

      The script to execute using the python interpreter. It will be executed during :code:`make test_python`
      and during `ctest`. You are required to either pass SCRIPT or MODULE.

      .. note::

         The script will be executed using :code:`${Python3_EXECUTABLE} SCRIPT`. If the INTERPRETER
         option is given, that interpreter is used instead.

   .. cmake_param:: MODULE
      :multi:

      The Python module to be executed.  It will be executed during :code:`make test_python`
      and during `ctest`. You are required to either pass SCRIPT or MODULE.

      .. note::

         The script will be executed using :code:`${Python3_EXECUTABLE} -m MODULE`. If the INTERPRETER
         option is given, that interpreter is used instead.

   .. cmake_param:: INTERPRETER
      :single:

      The Python interpreter to use for this test. It defaults to the one found by CMake.

   .. 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`.

