Skip to content

Commit

Permalink
add mock robot for docs testing
Browse files Browse the repository at this point in the history
  • Loading branch information
stuqdog committed Jan 28, 2025
1 parent 206b17d commit dedf354
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/examples/_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
from grpclib.server import Server, Stream
from grpclib.utils import graceful_exit

from viam.proto.robot import (
UnimplementedRobotServiceBase,
GetMachineStatusRequest,
GetMachineStatusResponse
)
from viam.app.data_client import DataClient
from viam.proto.app import (
AddRoleRequest,
Expand Down Expand Up @@ -595,6 +600,11 @@ async def GetRegistryItem(self, stream: Stream[GetRegistryItemRequest, GetRegist
raise NotImplementedError()


class MockRobot(UnimplementedRobotServiceBase):
async def GetMachineStatus(self, stream: Stream[GetMachineStatusRequest, GetMachineStatusResponse]) -> None:
await stream.send_message(GetMachineStatusResponse(state: GetMachineStatusResponse.STATE_RUNNING))


async def main(*, host: str = "127.0.0.1", port: int = 9092) -> None:
server = Server([MockData(), MockDataSync(), MockApp()])
with graceful_exit([server]):
Expand Down

0 comments on commit dedf354

Please sign in to comment.