Skip to content

Commit 15f02ca

Browse files
authored
Merge pull request #6 from Jepson2k/drop-sync-async_client-property
remove RobotClient.async_client property to eliminate cross-loop foot-gun
2 parents 9450fa1 + 502f738 commit 15f02ca

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

parol6/client/sync_client.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def _run(coro: Coroutine[Any, Any, T]) -> T:
102102
# A loop is running in this thread; blocking would be unsafe.
103103
raise RuntimeError(
104104
"RobotClient was used while an event loop is running.\n"
105-
"Use AsyncRobotClient and `await` the method instead."
105+
"Construct an AsyncRobotClient in this loop and `await` it instead."
106106
)
107107

108108

@@ -166,11 +166,6 @@ def __enter__(self) -> "RobotClient":
166166
def __exit__(self, exc_type, exc, tb) -> None:
167167
self.close()
168168

169-
@property
170-
def async_client(self) -> AsyncRobotClient:
171-
"""Access the underlying async client if you need it."""
172-
return self._inner
173-
174169
# Expose common configuration attributes
175170
@property
176171
def host(self) -> str:

tests/unit/test_conversions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_pose_identity_translation(monkeypatch):
2929
result = _pose_result(mat)
3030

3131
mock_request = AsyncMock(return_value=result)
32-
monkeypatch.setattr(client.async_client, "_request", mock_request)
32+
monkeypatch.setattr(client._inner, "_request", mock_request)
3333

3434
pose_rpy = client.pose()
3535
assert pose_rpy is not None
@@ -49,7 +49,7 @@ def test_pose_malformed_payload(monkeypatch):
4949
client = RobotClient()
5050

5151
mock_request = AsyncMock(return_value=PoseResultStruct(pose=[1, 2, 3]))
52-
monkeypatch.setattr(client.async_client, "_request", mock_request)
52+
monkeypatch.setattr(client._inner, "_request", mock_request)
5353

5454
pose_rpy = client.pose()
5555
assert pose_rpy is None

0 commit comments

Comments
 (0)