Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC] adding doctest guide to the testing documentation #4634

Merged
merged 14 commits into from May 27, 2023
39 changes: 39 additions & 0 deletions docs/source/developer_guide/continuous_integration.rst
Expand Up @@ -104,6 +104,45 @@ Further, developer IDEs such as pycharm or vs code will automatically recognize
the tests via ``pytest``, refer to the documentation of the IDEs for testing
via the embedded graphical user interface.

Running docstring examples via ``doctest``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sktime's Python modules are equipped with docstrings that include examples
demonstrating the usage of specific classes within each module. These examples
can be executed using doctest to ensure the expected functionality of the
modules after making modifications, thereby identifying any unforeseen bugs.

To run doctest on all the files with ``pytest``, navigate to the root directory and execute
the following command:

.. code:: bash

pytest --doctest-modules

To run doctest on all the files without ``pytest``, navigate to the root directory and execute
the following command:

(for ``UNIX`` based OS)
.. code:: bash

find . -name "*.py" -print0 | xargs -0 python -m doctest -v

(for windows)
.. code:: bash

for /r %G in (*.py) do python -m doctest -v "%G"

To run doctest on a specific module, navigate to the directory where the
module is located and execute the following command:

.. code:: bash

python -m doctest -v {filename}


Executing this command will display the test results for all the docstrings
contained within the module.

Alternative: dockerized testing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down