Skip to content

Commit

Permalink
Update developer guide
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippRue committed Nov 20, 2024
1 parent fc98f34 commit d0cb33b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions docs/source/developer_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@
Developer guide
===============

Running the tests
Automatic testing
+++++++++++++++++

AiiDA-KKR comes with a set of tests for its functionality. The tests are run through `pytest` and they are defined in `tests/` and the sub directories therein.
AiiDA-KKR comes with a set of tests for its functionality. The tests are run through ``pytest`` and they are defined in ``tests/`` and the sub directories therein.
The different tests are organized in the ``tests`` directory in the following structure:

The following will discover and run the unit test::
#. ``tests/``: files for common calcfunctions and workfunctions (i.e. not running any calculation of the plugin), tests for the entrypoints, common tools (e.g., ``plot_kkr``)
#. ``tests/conftest.py`` and ``tests/dbsetup.py``: configuration of the test environment (setting up DB with codes etc.)
#. ``tests/calculations/``: tests for calculations of the plugin (``VoronoiCalculation``, ``KkrCalculation``, ``KkrimpCalculation``, ``KkrnanoCalculation``)
#. ``tests/cmdline/``: tests for command line interface
#. ``tests/parsers/``: tests for calculation parsers
#. ``tests/tools/``: tests for tools that are part of AiiDA-KKR
#. ``tests/workflows/``: tests for the different workflows (using cached files for the calculations)
#. ``tests/data_dir/``: export files of tests that ran which are imported when tests are run to be able to use caching of the calculation instead of rerunning them

The following will run the unit tests::

# install aiida-kkr with testing extra
pip install -e .[testing]
Expand All @@ -18,11 +28,11 @@ The following will discover and run the unit test::
# run tests (-h shows help)
./run_all.sh -h
The coverage of the tests is controlled via environment variables (see `-h` option of `run_all.sh`), e.g.::
The coverage of the tests is controlled via environment variables (see ``-h`` option of ``run_all.sh``), e.g.::

RUN_VORONOI=1 RUN_KKRHOST=1 ./run_all.sh
If you use aiida-core >= v2.0 you should first migrate the input data::
If you use `aiida-core >= v2.0` you should first migrate the input data::

python migrate_exports.py
Expand All @@ -34,22 +44,22 @@ In order to recreate test export files you need real executables instead of the
# make sure the executables are found in the PATH
cd jukkr && export PATH="$PWD:$PATH" && cd ..
If your changes require updates to reference data (checked via the `pytest-regressions` package) you should add the `--force-regen` option to the pytest run::
If your changes require updates to reference data (checked via the ``pytest-regressions`` package) you should add the ``--force-regen`` option to the pytest run::

pytest --force-regen workflows/test_bs_wc.py

Automatic coding style checks
+++++++++++++++++++++++++++++


Automatic linter and coding style checks
++++++++++++++++++++++++++++++++++++++++

Enable enable automatic checks of code sanity and coding style::

pip install -e .[pre-commit]
pre-commit install

After this, the `yapf <https://github.com/google/yapf>`_ formatter,
the `pylint <https://www.pylint.org/>`_ linter
and the `pylint <https://www.pylint.org/>`_ code analyzer will
run at every commit.
the `pylint <https://www.pylint.org/>`_ linter and code analyzer will run at every commit.

To run the pre-commit hooks without making a commit use::

Expand All @@ -68,6 +78,7 @@ Continuous integration
#. run all tests for the ``django`` ORM
#. build the documentation
#. check coding style and version number (not required to pass by default)
#. run CI tests

Building the documentation
++++++++++++++++++++++++++
Expand Down Expand Up @@ -103,7 +114,7 @@ The latest release is therefore able to be installed via::

.. note::

When updating the plugin package to a new version, remember to update the version number both in ``setup.json`` and ``aiida_kkr/__init__.py``.
When updating the plugin package to a new version, remember to update the version number both in ``pyproject.toml`` and ``aiida_kkr/__init__.py``.


.. _ReadTheDocs: https://readthedocs.org/
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit d0cb33b

Please sign in to comment.