예제 #1
0
def test_application():
    app = Application({
        "modules": ["app_module"],
        "network": {
            "ip": "127.0.0.1"
        }
    })

    app.spine.register_event_handler("appReady", app_ready)
    app.spine.register_command_handler("signalModuleLoad", module_loaded)
    assert app.config.application.id == "kervi"
    assert app.config.modules == ["app_module"]
    assert app.config.network.ip == "127.0.0.1"

    app._xrun()

    process_info = app.spine.send_query("getProcessInfo")

    time.sleep(5)

    app.stop(False)
    assert APP_READY
    assert MODULE_LOADED == "test_x"
    assert len(process_info) == 4

    processes = [
        "application", "plugin_kervi.plugin.ipc.websocket",
        "plugin_kervi.plugin.ui.web", "app_module"
    ]

    for process in process_info:
        assert process["id"] in processes
예제 #2
0
from kervi.application import Application
import time

if __name__ == '__main__':

    def module_loaded(module_name):
        print("module:", module_name)

    app = Application()
    app.spine.register_event_handler("moduleLoaded", module_loaded)

    app._xrun()

    process_info = app.spine.send_query("getProcessInfo")
    print("pi", process_info)
    time.sleep(10)

    app.stop()