diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-23 05:06:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-23 05:06:51 +0000 |
commit | 57f704845136d9d0f0266c880cfa1dd7b902e880 (patch) | |
tree | 1c7ffc0d0bf371b2e3d425efbb1c055a24340dc7 /docs/contribution.md | |
parent | Releasing debian version 0.14.0-2. (diff) | |
download | anta-57f704845136d9d0f0266c880cfa1dd7b902e880.tar.xz anta-57f704845136d9d0f0266c880cfa1dd7b902e880.zip |
Merging upstream version 0.15.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/contribution.md')
-rw-r--r-- | docs/contribution.md | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/docs/contribution.md b/docs/contribution.md index 5c6ae8e..cc3a1c0 100644 --- a/docs/contribution.md +++ b/docs/contribution.md @@ -21,12 +21,14 @@ $ cd anta # Install ANTA in editable mode and its development tools $ pip install -e .[dev] +# To also install the CLI +$ pip install -e .[dev,cli] # Verify installation $ pip list -e Package Version Editable project location ------- ------- ------------------------- -anta 0.14.0 /mnt/lab/projects/anta +anta 0.15.0 /mnt/lab/projects/anta ``` Then, [`tox`](https://tox.wiki/) is configured with few environments to run CI locally: @@ -91,17 +93,20 @@ All submodule should have its own pytest section under `tests/units/anta_tests/< The Python modules in the `tests/units/anta_tests` folder define test parameters for AntaTest subclasses unit tests. A generic test function is written for all unit tests in `tests.lib.anta` module. + The `pytest_generate_tests` function definition in `conftest.py` is called during test collection. + The `pytest_generate_tests` function will parametrize the generic test function based on the `DATA` data structure defined in `tests.units.anta_tests` modules. + See https://docs.pytest.org/en/7.3.x/how-to/parametrize.html#basic-pytest-generate-tests-example -The `DATA` structure is a list of dictionaries used to parametrize the test. -The list elements have the following keys: -- `name` (str): Test name as displayed by Pytest. -- `test` (AntaTest): An AntaTest subclass imported in the test module - e.g. VerifyUptime. -- `eos_data` (list[dict]): List of data mocking EOS returned data to be passed to the test. -- `inputs` (dict): Dictionary to instantiate the `test` inputs as defined in the class from `test`. -- `expected` (dict): Expected test result structure, a dictionary containing a key +The `DATA` structure is a list of dictionaries used to parametrize the test. The list elements have the following keys: + + - `name` (str): Test name as displayed by Pytest. + - `test` (AntaTest): An AntaTest subclass imported in the test module - e.g. VerifyUptime. + - `eos_data` (list[dict]): List of data mocking EOS returned data to be passed to the test. + - `inputs` (dict): Dictionary to instantiate the `test` inputs as defined in the class from `test`. + - `expected` (dict): Expected test result structure, a dictionary containing a key `result` containing one of the allowed status (`Literal['success', 'failure', 'unset', 'skipped', 'error']`) and optionally a key `messages` which is a list(str) and each message is expected to be a substring of one of the actual messages in the TestResult object. |