Skip to content

Commit 7fd62da

Browse files
maint: Abstract class tests
1 parent 6f94f25 commit 7fd62da

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

src/ansys/tools/common/abstractions/connection.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,23 @@ class AbstractGRPCConnection(ABC):
4747
@abstractmethod
4848
def __init__(self, host: str, port: str) -> None:
4949
"""Initialize the gRPC connection with host and port."""
50-
self.__host = host
51-
self.__port = port
52-
pass
50+
pass # pragma: no cover
5351

5452
@abstractmethod
5553
def connect(self) -> None:
5654
"""Establish a connection to the gRPC server."""
57-
pass
55+
pass # pragma: no cover
5856

5957
@abstractmethod
6058
def close(self) -> None:
6159
"""Disconnect from the gRPC server."""
62-
pass
60+
pass # pragma: no cover
6361

6462
@property
6563
@abstractmethod
6664
def service(self):
6765
"""Return the gRPC stub for making requests."""
68-
pass
66+
pass # pragma: no cover
6967

7068
@property
7169
def _host(self) -> str:

tests/test_connection.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ def service(self):
5151
"""Service property that returns a mock gRPC stub."""
5252
return MagicMock()
5353

54-
@property
55-
def is_closed(self) -> bool:
56-
"""Status of the connection."""
57-
return not self._connected
58-
5954

6055
@pytest.fixture
6156
def mock_connection():
@@ -73,7 +68,6 @@ def test_initialization(mock_connection):
7368
def test_connect(mock_connection):
7469
"""Test connecting to the gRPC server."""
7570
mock_connection.connect()
76-
assert not mock_connection.is_closed
7771

7872

7973
def test_close(mock_connection):
@@ -93,7 +87,3 @@ def test_service_property(mock_connection):
9387
def test_is_closed_property(mock_connection):
9488
"""Test the is_closed property."""
9589
assert mock_connection.is_closed
96-
mock_connection.connect()
97-
assert not mock_connection.is_closed
98-
mock_connection.close()
99-
assert mock_connection.is_closed

0 commit comments

Comments
 (0)