From 92240acb5cc600eec60624ece9ed4b9ec43b386f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 23 May 2024 07:06:46 +0200 Subject: Adding upstream version 0.15.0. Signed-off-by: Daniel Baumann --- docs/contribution.md | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'docs/contribution.md') 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. -- cgit v1.2.3