Skip to content

Commit

Permalink
Merge branch 'main' into feat/md_report
Browse files Browse the repository at this point in the history
  • Loading branch information
carl-baillargeon authored Aug 19, 2024
2 parents 8918cd0 + 08e945b commit 7abf73a
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ repos:
- '<!--| ~| -->'

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
rev: v0.6.1
hooks:
- id: ruff
name: Run Ruff linter
Expand Down
2 changes: 1 addition & 1 deletion asynceapi/aio_portcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# -----------------------------------------------------------------------------


async def port_check_url(url: URL, timeout: int = 5) -> bool:
async def port_check_url(url: URL, timeout: int = 5) -> bool: # noqa: ASYNC109
"""
Open the port designated by the URL given the timeout in seconds.
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ dev = [
"pytest-html>=3.2.0",
"pytest-metadata>=3.0.0",
"pytest>=7.4.0",
"ruff>=0.5.4,<0.6.0",
"ruff>=0.5.4,<0.7.0",
"tox>=4.10.0,<5.0.0",
"types-PyYAML",
"types-pyOpenSSL",
Expand All @@ -81,7 +81,7 @@ dev = [
]
doc = [
"fontawesome_markdown",
"griffe",
"griffe >=0.46,<1.0.0",
"mike==2.1.3",
"mkdocs-autorefs>=0.4.1",
"mkdocs-bootswatch>=1.1",
Expand Down
16 changes: 8 additions & 8 deletions tests/lib/fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
}


@pytest.fixture()
@pytest.fixture
def device(request: pytest.FixtureRequest) -> Iterator[AntaDevice]:
"""Return an AntaDevice instance with mocked abstract method."""

Expand All @@ -83,7 +83,7 @@ def _collect(command: AntaCommand, *args: Any, **kwargs: Any) -> None: # noqa:
yield dev


@pytest.fixture()
@pytest.fixture
def test_inventory() -> AntaInventory:
"""Return the test_inventory."""
env = default_anta_env()
Expand All @@ -98,7 +98,7 @@ def test_inventory() -> AntaInventory:


# tests.unit.test_device.py fixture
@pytest.fixture()
@pytest.fixture
def async_device(request: pytest.FixtureRequest) -> AsyncEOSDevice:
"""Return an AsyncEOSDevice instance."""
kwargs = {
Expand All @@ -115,7 +115,7 @@ def async_device(request: pytest.FixtureRequest) -> AsyncEOSDevice:


# tests.units.result_manager fixtures
@pytest.fixture()
@pytest.fixture
def test_result_factory(device: AntaDevice) -> Callable[[int], TestResult]:
"""Return a anta.result_manager.models.TestResult object."""
# pylint: disable=redefined-outer-name
Expand All @@ -133,7 +133,7 @@ def _create(index: int = 0) -> TestResult:
return _create


@pytest.fixture()
@pytest.fixture
def list_result_factory(test_result_factory: Callable[[int], TestResult]) -> Callable[[int], list[TestResult]]:
"""Return a list[TestResult] with 'size' TestResult instantiated using the test_result_factory fixture."""
# pylint: disable=redefined-outer-name
Expand All @@ -145,7 +145,7 @@ def _factory(size: int = 0) -> list[TestResult]:
return _factory


@pytest.fixture()
@pytest.fixture
def result_manager_factory(list_result_factory: Callable[[int], list[TestResult]]) -> Callable[[int], ResultManager]:
"""Return a ResultManager factory that takes as input a number of tests."""
# pylint: disable=redefined-outer-name
Expand Down Expand Up @@ -185,7 +185,7 @@ def result_manager() -> ResultManager:


# tests.units.cli fixtures
@pytest.fixture()
@pytest.fixture
def temp_env(tmp_path: Path) -> dict[str, str | None]:
"""Fixture that create a temporary ANTA inventory.
Expand All @@ -199,7 +199,7 @@ def temp_env(tmp_path: Path) -> dict[str, str | None]:
return env


@pytest.fixture()
@pytest.fixture
# Disabling C901 - too complex as we like our runner like this
def click_runner(capsys: pytest.CaptureFixture[str]) -> Iterator[CliRunner]: # noqa: C901
"""Return a click.CliRunner for cli testing."""
Expand Down
2 changes: 1 addition & 1 deletion tests/units/cli/exec/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


# TODO: complete test cases
@pytest.mark.asyncio()
@pytest.mark.asyncio
@pytest.mark.parametrize(
("inventory_state", "per_device_command_output", "tags"),
[
Expand Down
8 changes: 4 additions & 4 deletions tests/units/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@
class TestAntaDevice:
"""Test for anta.device.AntaDevice Abstract class."""

@pytest.mark.asyncio()
@pytest.mark.asyncio
@pytest.mark.parametrize(
("device", "command_data", "expected_data"),
((d["device"], d["command"], d["expected"]) for d in COLLECT_DATA),
Expand Down Expand Up @@ -693,7 +693,7 @@ def test__eq(self, data: dict[str, Any]) -> None:
else:
assert device1 != device2

@pytest.mark.asyncio()
@pytest.mark.asyncio
@pytest.mark.parametrize(
("async_device", "patch_kwargs", "expected"),
((d["device"], d["patch_kwargs"], d["expected"]) for d in REFRESH_DATA),
Expand All @@ -712,7 +712,7 @@ async def test_refresh(self, async_device: AsyncEOSDevice, patch_kwargs: list[di
assert async_device.established == expected["established"]
assert async_device.hw_model == expected["hw_model"]

@pytest.mark.asyncio()
@pytest.mark.asyncio
@pytest.mark.parametrize(
("async_device", "command", "expected"),
((d["device"], d["command"], d["expected"]) for d in ASYNCEAPI_COLLECT_DATA),
Expand Down Expand Up @@ -745,7 +745,7 @@ async def test__collect(self, async_device: AsyncEOSDevice, command: dict[str, A
assert cmd.output == expected["output"]
assert cmd.errors == expected["errors"]

@pytest.mark.asyncio()
@pytest.mark.asyncio
@pytest.mark.parametrize(
("async_device", "copy"),
((d["device"], d["copy"]) for d in ASYNCEAPI_COPY_DATA),
Expand Down
12 changes: 6 additions & 6 deletions tests/units/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
FAKE_CATALOG: AntaCatalog = AntaCatalog.from_list([(FakeTest, None)])


@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_runner_empty_tests(caplog: pytest.LogCaptureFixture, test_inventory: AntaInventory) -> None:
"""Test that when the list of tests is empty, a log is raised.
Expand All @@ -40,7 +40,7 @@ async def test_runner_empty_tests(caplog: pytest.LogCaptureFixture, test_invento
assert "The list of tests is empty, exiting" in caplog.records[0].message


@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_runner_empty_inventory(caplog: pytest.LogCaptureFixture) -> None:
"""Test that when the Inventory is empty, a log is raised.
Expand All @@ -55,7 +55,7 @@ async def test_runner_empty_inventory(caplog: pytest.LogCaptureFixture) -> None:
assert "The inventory is empty, exiting" in caplog.records[1].message


@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_runner_no_selected_device(caplog: pytest.LogCaptureFixture, test_inventory: AntaInventory) -> None:
"""Test that when the list of established device.
Expand Down Expand Up @@ -140,7 +140,7 @@ def side_effect_setrlimit(resource_id: int, limits: tuple[int, int]) -> None:
setrlimit_mock.assert_called_once_with(resource.RLIMIT_NOFILE, (16384, 1048576))


@pytest.mark.asyncio()
@pytest.mark.asyncio
@pytest.mark.parametrize(
("tags", "expected_tests_count", "expected_devices_count"),
[
Expand Down Expand Up @@ -173,7 +173,7 @@ async def test_prepare_tests(
assert sum(len(tests) for tests in selected_tests.values()) == expected_tests_count


@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_prepare_tests_with_specific_tests(caplog: pytest.LogCaptureFixture, test_inventory: AntaInventory) -> None:
"""Test the runner prepare_tests function with specific tests."""
logger.setup_logging(logger.Log.INFO)
Expand All @@ -187,7 +187,7 @@ async def test_prepare_tests_with_specific_tests(caplog: pytest.LogCaptureFixtur
assert sum(len(tests) for tests in selected_tests.values()) == 5


@pytest.mark.asyncio()
@pytest.mark.asyncio
async def test_runner_dry_run(caplog: pytest.LogCaptureFixture, test_inventory: AntaInventory) -> None:
"""Test that when dry_run is True, no tests are run.
Expand Down

0 comments on commit 7abf73a

Please sign in to comment.