示例#1
0
async def full_server(base_server: Server) -> AsyncIterator[Server]:
    base_server.load_components()
    ret = base_server.server_init(start_server=False)
    await asyncio.wait_for(ret, 4.)
    yield base_server
    if base_server.event_loop.aioloop.is_running():
        await base_server._stop_server(exit_reason="terminate")
async def test_call_remote_method(base_server: Server, klippy: KlippyProcess):
    fut = base_server.get_event_loop().create_future()

    def method_test(result):
        fut.set_result(result)

    base_server.register_remote_method("moonraker_test", method_test)
    base_server.load_components()
    await base_server.server_init()
    ret = base_server.klippy_connection.wait_connected()
    await asyncio.wait_for(ret, 4.)
    klippy.send_gcode("TEST_REMOTE_METHOD")
    await fut
    await base_server._stop_server("terminate")
    assert fut.result() == "test"
示例#3
0
 async def core_server(self, base_server: Server) -> AsyncIterator[Server]:
     base_server.load_components()
     yield base_server
     await base_server._stop_server("terminate")