(caplog)
| 130 | |
| 131 | |
| 132 | async def test_mixed_async_sync(caplog): |
| 133 | with taddons.context(loadcore=False) as tctx: |
| 134 | a = tctx.master.addons |
| 135 | |
| 136 | assert len(a) == 0 |
| 137 | a1 = TAddon("sync") |
| 138 | a2 = AsyncTAddon("async") |
| 139 | a.add(a1) |
| 140 | a.add(a2) |
| 141 | |
| 142 | # test that we can call both sync and async hooks asynchronously |
| 143 | assert not a1.running_called |
| 144 | assert not a2.running_called |
| 145 | await a.trigger_event(hooks.RunningHook()) |
| 146 | assert a1.running_called |
| 147 | assert a2.running_called |
| 148 | |
| 149 | # test that calling an async hook synchronously fails |
| 150 | a1.running_called = False |
| 151 | a2.running_called = False |
| 152 | a.trigger(hooks.RunningHook()) |
| 153 | assert a1.running_called |
| 154 | assert "called from sync context" in caplog.text |
| 155 | |
| 156 | |
| 157 | async def test_loader(caplog): |
nothing calls this directly
no test coverage detected
searching dependent graphs…