-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/tag-mapping
- Loading branch information
Showing
11 changed files
with
167 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" | |
|
||
[project] | ||
name = "anta" | ||
version = "v0.9.0" | ||
version = "v0.10.0" | ||
readme = "docs/README.md" | ||
authors = [{ name = "Khelil Sator", email = "[email protected]" }] | ||
maintainers = [ | ||
|
@@ -52,7 +52,7 @@ requires-python = ">=3.8" | |
|
||
[project.optional-dependencies] | ||
dev = [ | ||
"bumpver==2023.1126", | ||
"bumpver==2023.1129", | ||
"black==23.9.1", | ||
"flake8==6.1.0", | ||
"isort==5.12.0", | ||
|
@@ -108,7 +108,7 @@ namespaces = false | |
# Version | ||
################################ | ||
[tool.bumpver] | ||
current_version = "0.9.0" | ||
current_version = "0.10.0" | ||
version_pattern = "MAJOR.MINOR.PATCH" | ||
commit_message = "bump: Version {old_version} -> {new_version}" | ||
commit = true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Copyright (c) 2023 Arista Networks, Inc. | ||
# Use of this source code is governed by the Apache License 2.0 | ||
# that can be found in the LICENSE file. | ||
""" | ||
test anta.runner.py | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
import pytest | ||
|
||
from anta.inventory import AntaInventory | ||
from anta.models import AntaTest | ||
from anta.result_manager import ResultManager | ||
from anta.runner import main | ||
|
||
if TYPE_CHECKING: | ||
from pytest import LogCaptureFixture | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_runner_empty_tests(caplog: LogCaptureFixture, test_inventory: AntaInventory) -> None: | ||
""" | ||
Test that when the list of tests is empty, a log is raised | ||
caplog is the pytest fixture to capture logs | ||
test_inventory is a fixture that gives a default inventory for tests | ||
""" | ||
manager = ResultManager() | ||
await main(manager, test_inventory, []) | ||
|
||
assert len(caplog.record_tuples) == 1 | ||
assert "The list of tests is empty, exiting" in caplog.records[0].message | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_runner_empty_inventory(caplog: LogCaptureFixture) -> None: | ||
""" | ||
Test that when the Inventory is empty, a log is raised | ||
caplog is the pytest fixture to capture logs | ||
""" | ||
manager = ResultManager() | ||
inventory = AntaInventory() | ||
# This is not vaidated in this test | ||
tests: list[tuple[type[AntaTest], AntaTest.Input]] = [(AntaTest, {})] # type: ignore[type-abstract] | ||
await main(manager, inventory, tests) | ||
|
||
assert len(caplog.record_tuples) == 1 | ||
assert "The inventory is empty, exiting" in caplog.records[0].message | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_runner_no_selected_device(caplog: LogCaptureFixture, test_inventory: AntaInventory) -> None: | ||
""" | ||
Test that when the list of established device | ||
caplog is the pytest fixture to capture logs | ||
test_inventory is a fixture that gives a default inventory for tests | ||
""" | ||
manager = ResultManager() | ||
# This is not vaidated in this test | ||
tests: list[tuple[type[AntaTest], AntaTest.Input]] = [(AntaTest, {})] # type: ignore[type-abstract] | ||
|
||
await main(manager, test_inventory, tests) | ||
|
||
assert "No device in the established state 'True' was found. There is no device to run tests against, exiting" in [record.message for record in caplog.records] | ||
|
||
# Reset logs and run with tags | ||
caplog.clear() | ||
await main(manager, test_inventory, tests, tags=["toto"]) | ||
|
||
assert "No device in the established state 'True' matching the tags ['toto'] was found. There is no device to run tests against, exiting" in [ | ||
record.message for record in caplog.records | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters