Skip to content

Commit

Permalink
Merge pull request #1401 from ejoerns/pytest
Browse files Browse the repository at this point in the history
Replace sharness-based test suite by pytest
  • Loading branch information
ejoerns committed May 10, 2024
2 parents 66988cd + 3610e98 commit cd3aa7c
Show file tree
Hide file tree
Showing 26 changed files with 2,333 additions and 2,346 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@ jobs:
- name: Run codespell check
run: |
codespell -L parms,cas -S 'openssl-ca,build,*.log' src include test docs
- name: Install ruff & run checks
run: |
python3 -m venv venv
. venv/bin/activate
pip install ruff
ruff format --check --diff test/ && ruff check test/
4 changes: 2 additions & 2 deletions docs/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,8 @@ When working with PKCS#11, some tools are useful to configure and show your toke
It is used in the RAUC test suite to emulate a real HSM and can also be used
to try the PKCS#11 functionality in RAUC without any hardware.
The ``prepare_softhsm2`` shell function in ``test/rauc.t`` can be used as an
example on how to initialize SoftHSM2 token.
The ``prepare_softhsm2`` pytest fixture in ``test/conftest.py`` can be used
as an example on how to initialize SoftHSM2 token.
`aws-kms-pkcs11 <https://github.com/JackOfMostTrades/aws-kms-pkcs11>`_
aws-kms-pkcs11 is a PKCS#11 which uses the AWS KMS as its backend.
Expand Down
19 changes: 12 additions & 7 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,26 @@ To make sure your changes match the expected code style, run::
from the RAUC source code's root directory.
It will adapt style where necessary.

CLI Tests - sharness
~~~~~~~~~~~~~~~~~~~~
CLI Tests - pytest
~~~~~~~~~~~~~~~~~~

For high-level tests of the RAUC command line interface we use the `sharness
<https://github.com/chriscool/sharness>`_ shell library.
For high-level tests of the RAUC command line interface we use `pytest
<https://docs.pytest.org/>`_.

You can run these checks manually by executing::

cd test
./rauc.t
pytest test/

from the RAUC source code's root directory but they will also be triggered by
the general test suite run (see below).
If you add or change subcommands or arguments of the CLI tool, make sure these
tests succeed and extend them if possible.
When touching the test code, make sure to run the 'ruff' linter/formatter on
the changed code::

ruff format test/
ruff check test/

As many of these tests need root permissions, we recommend running them using the
``qemu-test`` helper below.

Expand All @@ -98,7 +103,7 @@ To run all tests, run::

meson test -C build

This will also run the sharness CLI tests mentioned above.
This will also run the pytest CLI tests mentioned above.

.. note:: Although some of the tests need to run as root, do NOT use 'sudo', but
use our ``qemu-test`` helper instead!
Expand Down
7 changes: 0 additions & 7 deletions tap-t

This file was deleted.

1 change: 1 addition & 0 deletions test/.ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
line-length = 119

0 comments on commit cd3aa7c

Please sign in to comment.