Merging upstream version 1.2.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
ae7b7df396
commit
afeccccd6a
154 changed files with 7346 additions and 5000 deletions
|
@ -5,19 +5,21 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from anta.result_manager import ResultManager
|
||||
from anta.runner import get_coroutines, prepare_tests
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections import defaultdict
|
||||
from collections.abc import Coroutine
|
||||
|
||||
from pytest_codspeed import BenchmarkFixture
|
||||
|
||||
from anta.catalog import AntaCatalog, AntaTestDefinition
|
||||
from anta.device import AntaDevice
|
||||
from anta.inventory import AntaInventory
|
||||
from anta.result_manager.models import TestResult
|
||||
|
||||
|
||||
def test_prepare_tests(benchmark: BenchmarkFixture, catalog: AntaCatalog, inventory: AntaInventory) -> None:
|
||||
|
@ -40,9 +42,13 @@ def test_get_coroutines(benchmark: BenchmarkFixture, catalog: AntaCatalog, inven
|
|||
|
||||
assert selected_tests is not None
|
||||
|
||||
coroutines = benchmark(lambda: get_coroutines(selected_tests=selected_tests, manager=ResultManager()))
|
||||
for coros in coroutines:
|
||||
coros.close()
|
||||
def bench() -> list[Coroutine[Any, Any, TestResult]]:
|
||||
coros = get_coroutines(selected_tests=selected_tests, manager=ResultManager())
|
||||
for c in coros:
|
||||
c.close()
|
||||
return coros
|
||||
|
||||
coroutines = benchmark(bench)
|
||||
|
||||
count = sum(len(tests) for tests in selected_tests.values())
|
||||
assert count == len(coroutines)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue