Unit Tests ========== Unit tests should be based on `unittest`_, while `doctest`_ is not recommended for limited usage. In the end, `pytest`_ is used to perform the unittests. And `coverage`_ is used to assess the unit test coverage. To run unit tests .. code-block:: bash pytest --import-mode=importlib To run unit tests with coverage .. code-block:: bash coverage run -m pytest --import-mode=importlib To display the coverage report .. code-block:: bash coverage report To generate the coverage report in html format .. code-block:: bash coverage html .. _unittest: https://docs.python.org/3.9/library/unittest.html .. _doctest: https://docs.python.org/3.9/library/doctest.html .. _pytest: https://docs.pytest.org/en/7.1.x .. _coverage: https://coverage.readthedocs.io/en/6.5.0/ Conventions ----------- Before write his own unit test scripts, a developer should have a glance at the conventions on how `pytest`_ discovers unit tests (e.g, `test_*.py` or `*_test.py` files). For more information, click `here`_. .. _here: https://docs.pytest.org/en/7.1.x/explanation/goodpractices.html#test-discovery