Merging upstream version 0.15.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
bfebc2a0f4
commit
0a0cb7f4fd
103 changed files with 79620 additions and 742 deletions
|
@ -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.
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue