(caplog)
| 175 | |
| 176 | |
| 177 | async def test_simple(caplog): |
| 178 | with taddons.context(loadcore=False) as tctx: |
| 179 | a = tctx.master.addons |
| 180 | |
| 181 | assert len(a) == 0 |
| 182 | a.add(TAddon("one")) |
| 183 | assert a.get("one") |
| 184 | assert not a.get("two") |
| 185 | assert len(a) == 1 |
| 186 | a.clear() |
| 187 | assert len(a) == 0 |
| 188 | assert not a.chain |
| 189 | |
| 190 | with taddons.context(loadcore=False) as tctx: |
| 191 | a.add(TAddon("one")) |
| 192 | |
| 193 | a.trigger("nonexistent") |
| 194 | assert "AssertionError" in caplog.text |
| 195 | |
| 196 | f = tflow.tflow() |
| 197 | a.trigger(hooks.RunningHook()) |
| 198 | a.trigger(HttpResponseHook(f)) |
| 199 | assert "not callable" in caplog.text |
| 200 | caplog.clear() |
| 201 | |
| 202 | caplog.clear() |
| 203 | a.get("one").response = addons |
| 204 | a.trigger(HttpResponseHook(f)) |
| 205 | assert "not callable" not in caplog.text |
| 206 | |
| 207 | a.remove(a.get("one")) |
| 208 | assert not a.get("one") |
| 209 | |
| 210 | ta = TAddon("one") |
| 211 | a.add(ta) |
| 212 | a.trigger(hooks.RunningHook()) |
| 213 | assert ta.running_called |
| 214 | |
| 215 | assert ta in a |
| 216 | |
| 217 | |
| 218 | async def test_load_option(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…