2022-02-09 16:47:12 +00:00
|
|
|
Instructions for contributors
|
2018-01-23 21:34:27 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
2022-01-19 09:44:20 +00:00
|
|
|
Contribute to python-tuf by submitting pull requests against the "develop"
|
|
|
|
|
branch of this repository. Detailed instructions are available in our
|
|
|
|
|
`development guidelines
|
|
|
|
|
<https://github.com/secure-systems-lab/lab-guidelines/blob/master/dev-workflow.md>`_.
|
|
|
|
|
All submitted code should follow our `style guidelines
|
|
|
|
|
<https://github.com/secure-systems-lab/code-style-guidelines/blob/master/python.md>`_
|
2022-01-20 13:43:26 +00:00
|
|
|
and must be `unit tested <#unit-tests>`_.
|
2018-01-23 21:34:27 +00:00
|
|
|
|
2022-02-09 16:44:12 +00:00
|
|
|
.. note::
|
2018-01-23 21:34:27 +00:00
|
|
|
|
2022-02-10 09:10:20 +00:00
|
|
|
Also see `development installation instructions <https://theupdateframework.readthedocs.io/en/latest/INSTALLATION.html#install-for-development>`_.
|
2019-04-08 20:27:29 +00:00
|
|
|
|
2024-02-27 14:38:29 +00:00
|
|
|
DCO
|
|
|
|
|
===
|
|
|
|
|
|
|
|
|
|
Contributors must indicate acceptance of the `Developer Certificate of
|
|
|
|
|
Origin <https://developercertificate.org/>`_ by appending a ``Signed-off-by:
|
|
|
|
|
Your Name <example@domain.com>`` to each git commit message (see `git commit
|
|
|
|
|
--signoff <https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff>`_).
|
|
|
|
|
|
2022-01-19 09:44:20 +00:00
|
|
|
Testing
|
|
|
|
|
=======
|
2021-03-17 12:54:41 +00:00
|
|
|
|
2022-02-09 16:49:51 +00:00
|
|
|
With `tox <https:///tox.wiki>`_ the whole test suite can be executed in
|
2022-01-20 13:43:26 +00:00
|
|
|
a separate *virtual environment* for each supported Python version available on
|
|
|
|
|
the system. ``tuf`` and its dependencies are installed automatically for each
|
|
|
|
|
tox run.
|
2021-03-17 12:54:41 +00:00
|
|
|
|
2022-01-19 09:44:20 +00:00
|
|
|
::
|
2021-03-17 12:54:41 +00:00
|
|
|
|
2024-06-04 06:33:49 +00:00
|
|
|
tox
|
2021-03-17 12:54:41 +00:00
|
|
|
|
2022-01-20 13:43:26 +00:00
|
|
|
Below, you will see more details about each step managed by ``tox``, in case
|
2022-01-19 09:44:20 +00:00
|
|
|
you need debug/run outside ``tox``.
|
2021-03-17 12:54:41 +00:00
|
|
|
|
2022-01-19 09:44:20 +00:00
|
|
|
Unit tests
|
|
|
|
|
----------
|
2018-01-23 21:34:27 +00:00
|
|
|
|
2022-01-19 09:44:20 +00:00
|
|
|
More specifically, the Update Framework's test suite can be executed by invoking
|
|
|
|
|
the test aggregation script inside the *tests* subdirectory. ``tuf`` and its
|
|
|
|
|
dependencies must already be installed.
|
2019-09-16 16:42:46 +00:00
|
|
|
::
|
|
|
|
|
|
2024-06-04 06:33:49 +00:00
|
|
|
cd tests/
|
|
|
|
|
python3 aggregate_tests.py
|
2019-09-16 16:42:46 +00:00
|
|
|
|
2022-01-19 09:44:20 +00:00
|
|
|
|
2022-01-20 13:43:26 +00:00
|
|
|
Individual tests can also be executed. Optional ``-v`` flags can be added to
|
|
|
|
|
increase log level up to DEBUG (``-vvvv``).
|
|
|
|
|
::
|
2020-09-15 19:30:20 +00:00
|
|
|
|
2024-06-04 06:33:49 +00:00
|
|
|
cd tests/
|
|
|
|
|
python3 test_updater_ng.py -v
|
2019-09-16 16:42:46 +00:00
|
|
|
|
2020-09-24 15:48:46 +00:00
|
|
|
|
2022-01-19 09:44:20 +00:00
|
|
|
Coverage
|
|
|
|
|
--------
|
2020-09-24 15:48:46 +00:00
|
|
|
|
2019-09-18 08:18:13 +00:00
|
|
|
To run the tests and measure their code coverage, the aggregation script can be
|
|
|
|
|
invoked with the ``coverage`` tool (requires installation of ``coverage``, e.g.
|
|
|
|
|
via PyPI).
|
2019-09-16 16:42:46 +00:00
|
|
|
::
|
|
|
|
|
|
2024-06-04 06:33:49 +00:00
|
|
|
cd tests/
|
|
|
|
|
coverage run aggregate_tests.py && coverage report
|
2019-09-16 16:42:46 +00:00
|
|
|
|
|
|
|
|
|
2022-01-19 09:44:20 +00:00
|
|
|
Auto-formatting
|
|
|
|
|
---------------
|
2019-09-16 16:42:46 +00:00
|
|
|
|
2024-02-27 14:38:29 +00:00
|
|
|
The linter in CI/CD will check that new TUF code is formatted with
|
2024-02-29 13:54:18 +00:00
|
|
|
`ruff <https://docs.astral.sh/ruff/>`_. Auto-formatting can be done on the
|
2024-02-27 14:38:29 +00:00
|
|
|
command line:
|
2022-01-19 09:44:20 +00:00
|
|
|
::
|
2019-09-16 16:42:46 +00:00
|
|
|
|
2024-06-04 06:33:49 +00:00
|
|
|
tox -e fix
|