コード例 #1
0
 async def coro():
     async with anyio.create_task_group() as tg:
         manager = PluginManager(tg,
                                 "hbmqtt.test.plugins",
                                 context=None)
         ret = await call_coro(manager)
         plugin = manager.get_plugin("event_plugin")
         self.assertEqual(ret[plugin], "TEST")
コード例 #2
0
    def test_map_coro_return(self):
        async def call_coro():
            return await manager.map_plugin_coro("ret_coro")

        manager = PluginManager("hbmqtt.test.plugins", context=None, loop=self.loop)
        ret = self.loop.run_until_complete(call_coro())
        plugin = manager.get_plugin("event_plugin")
        self.assertEqual(ret[plugin], "TEST")
コード例 #3
0
 async def coro():
     async with anyio.create_task_group() as tg:
         manager = PluginManager(tg,
                                 "hbmqtt.test.plugins",
                                 context=None)
         await call_coro(manager)
         plugin = manager.get_plugin("event_plugin")
         self.assertTrue(plugin.object.test_coro)
コード例 #4
0
    def test_map_coro(self):
        async def call_coro():
            await manager.map_plugin_coro("test_coro")

        manager = PluginManager("hbmqtt.test.plugins", context=None, loop=self.loop)
        self.loop.run_until_complete(call_coro())
        plugin = manager.get_plugin("event_plugin")
        assert plugin.object.test_coro
コード例 #5
0
ファイル: test_manager.py プロジェクト: FlorianLudwig/hbmqtt
    def test_map_coro_return(self):
        @asyncio.coroutine
        def call_coro():
            return (yield from manager.map_plugin_coro('ret_coro'))

        manager = PluginManager("hbmqtt.test.plugins", context=None, loop=self.loop)
        ret = self.loop.run_until_complete(call_coro())
        plugin = manager.get_plugin("event_plugin")
        self.assertEqual(ret[plugin], "TEST")
コード例 #6
0
ファイル: test_manager.py プロジェクト: FlorianLudwig/hbmqtt
    def test_map_coro(self):
        @asyncio.coroutine
        def call_coro():
            yield from manager.map_plugin_coro('test_coro')

        manager = PluginManager("hbmqtt.test.plugins", context=None, loop=self.loop)
        self.loop.run_until_complete(call_coro())
        plugin = manager.get_plugin("event_plugin")
        self.assertTrue(plugin.object.test_coro)
コード例 #7
0
    def test_fire_event_wait(self):
        async def fire_event():
            await manager.fire_event("test", wait=True)
            await manager.close()

        manager = PluginManager("hbmqtt.test.plugins", context=None, loop=self.loop)
        self.loop.run_until_complete(fire_event())
        plugin = manager.get_plugin("event_plugin")
        assert plugin.object.test_flag
コード例 #8
0
    def test_map_coro_return(self):
        @asyncio.coroutine
        def call_coro():
            return (yield from manager.map_plugin_coro('ret_coro'))

        manager = PluginManager("hbmqtt.test.plugins", context=None, loop=self.loop)
        ret = self.loop.run_until_complete(call_coro())
        plugin = manager.get_plugin("event_plugin")
        self.assertEqual(ret[plugin], "TEST")
コード例 #9
0
    def test_map_coro(self):
        @asyncio.coroutine
        def call_coro():
            yield from manager.map_plugin_coro('test_coro')

        manager = PluginManager("hbmqtt.test.plugins", context=None, loop=self.loop)
        self.loop.run_until_complete(call_coro())
        plugin = manager.get_plugin("event_plugin")
        self.assertTrue(plugin.object.test_coro)
コード例 #10
0
ファイル: test_manager.py プロジェクト: FlorianLudwig/hbmqtt
    def test_fire_event_wait(self):
        @asyncio.coroutine
        def fire_event():
            yield from manager.fire_event("test", wait=True)
            yield from manager.close()

        manager = PluginManager("hbmqtt.test.plugins", context=None, loop=self.loop)
        self.loop.run_until_complete(fire_event())
        plugin = manager.get_plugin("event_plugin")
        self.assertTrue(plugin.object.test_flag)
コード例 #11
0
    def test_fire_event_wait(self):
        @asyncio.coroutine
        def fire_event():
            yield from manager.fire_event("test", wait=True)
            yield from manager.close()

        manager = PluginManager("hbmqtt.test.plugins", context=None, loop=self.loop)
        self.loop.run_until_complete(fire_event())
        plugin = manager.get_plugin("event_plugin")
        self.assertTrue(plugin.object.test_flag)