Skip to content

Commit

Permalink
fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
yanksyoon committed May 8, 2024
1 parent de66eb6 commit 2b658a5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/charm_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def _get_credentials_from_agent_relation(
return Credentials(address=address, secret=secret)


def _get_packages_to_install(charm: ops.CharmBase) -> tuple[str, ...]:
def _get_packages_to_install(charm: ops.CharmBase) -> typing.Tuple[str, ...]:
"""Get list of apt packages to install from charm configuration.
Args:
Expand Down Expand Up @@ -147,7 +147,7 @@ class State:

agent_meta: AgentMeta
agent_relation_credentials: typing.Optional[Credentials]
apt_packages: tuple[str, ...]
apt_packages: typing.Tuple[str, ...]
unit_data: UnitData
jenkins_agent_service_name: str = "jenkins-agent"

Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""Test for service interaction."""

import os
import typing
from pathlib import Path
from unittest.mock import MagicMock

Expand Down Expand Up @@ -92,7 +93,7 @@ def test_on_install_packages_fail(monkeypatch: pytest.MonkeyPatch):
pytest.param(("hello", "world"), id="Has packages"),
],
)
def test_on_install_packages(monkeypatch: pytest.MonkeyPatch, packages: tuple[str, ...]):
def test_on_install_packages(monkeypatch: pytest.MonkeyPatch, packages: typing.Tuple[str, ...]):
"""
arrange: Given a monkeypatched apt lib and list of packages to install.
act: when install_apt_packages is called.
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# pylint:disable=protected-access

import os
import typing
from unittest.mock import MagicMock

import ops
Expand Down Expand Up @@ -44,7 +45,7 @@ def test_from_charm_invalid_metadata(
],
)
def test__get_packages_to_install(
harness: ops.testing.Harness, packages: str, expected: tuple[str, ...]
harness: ops.testing.Harness, packages: str, expected: typing.Tuple[str, ...]
):
"""
arrange: given charm apt-packages config.
Expand Down

0 comments on commit 2b658a5

Please sign in to comment.