Skip to content

Commit

Permalink
Make unit tests py3.12 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
hemanthnakkina committed Jan 7, 2025
1 parent 5b2988d commit b451ff9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
4 changes: 2 additions & 2 deletions sunbeam-python/tests/unit/sunbeam/core/test_juju.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ async def test_jhelper_get_leader_unit(
app = "k8s"
unit = await jhelper.get_leader_unit(app, "control-plane")
assert unit is not None
assert applications.get.called_with(app)
applications.get.assert_called_with(app)


@pytest.mark.asyncio
Expand Down Expand Up @@ -334,7 +334,7 @@ async def test_jhelper_get_application(
):
app = await jhelper.get_application("k8s", "control-plane")
assert app is not None
assert applications.get.called_with("k8s")
applications.get.assert_called_with("k8s")


@pytest.mark.asyncio
Expand Down
22 changes: 0 additions & 22 deletions sunbeam-python/tests/unit/sunbeam/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@
# limitations under the License.

import textwrap
from dataclasses import InitVar
from unittest.mock import mock_open, patch

import pytest
from pydantic import PrivateAttr
from pydantic.dataclasses import dataclass

import sunbeam.utils as utils

Expand Down Expand Up @@ -58,25 +55,6 @@ def ifaddresses():
yield p


@dataclass
class B:
b_str: str | None = None
b_dict: dict | None = None


@dataclass
class A:
a_init: InitVar[str]
a_priv: str = PrivateAttr(default="a_priv")
a_int: int | None = None
a_str: str | None = None
a_dict: dict | None = None
a_dict_b: dict[str, B] | None = None

def __post_init__(self, a_init):
self.a_priv = "a_priv"


class TestUtils:
def test_get_fqdn(self, mocker):
gethostname = mocker.patch("sunbeam.utils.socket.gethostname")
Expand Down

0 comments on commit b451ff9

Please sign in to comment.