From 641d0d615623d4818993e1967fc96af1eefc4605 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 10:35:51 +0200 Subject: Adding upstream version 0.14.0. Signed-off-by: Daniel Baumann --- tests/conftest.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'tests/conftest.py') diff --git a/tests/conftest.py b/tests/conftest.py index 5a40c24..7aa229c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,19 +1,15 @@ # Copyright (c) 2023-2024 Arista Networks, Inc. # Use of this source code is governed by the Apache License 2.0 # that can be found in the LICENSE file. -""" -conftest.py - used to store anta specific fixtures used for tests -""" +"""conftest.py - used to store anta specific fixtures used for tests.""" + from __future__ import annotations import logging -from typing import TYPE_CHECKING, Any +from typing import Any import pytest -if TYPE_CHECKING: - from pytest import Metafunc - # Load fixtures from dedicated file tests/lib/fixture.py # As well as pytest_asyncio plugin to test co-routines pytest_plugins = [ @@ -31,8 +27,7 @@ for _ in ("asyncio", "httpx"): def build_test_id(val: dict[str, Any]) -> str: - """ - build id for a unit test of an AntaTest subclass + """Build id for a unit test of an AntaTest subclass. { "name": "meaniful test name", @@ -43,9 +38,9 @@ def build_test_id(val: dict[str, Any]) -> str: return f"{val['test'].__module__}.{val['test'].__name__}-{val['name']}" -def pytest_generate_tests(metafunc: Metafunc) -> None: - """ - This function is called during test collection. +def pytest_generate_tests(metafunc: pytest.Metafunc) -> None: + """Generate ANTA testts unit tests dynamically during test collection. + It will parametrize test cases based on the `DATA` data structure defined in `tests.units.anta_tests` modules. See `tests/units/anta_tests/README.md` for more information on how to use it. Test IDs are generated using the `build_test_id` function above. -- cgit v1.2.3