| 48 | tctx.configure(rf, readfile_filter="") |
| 49 | |
| 50 | async def test_read(self, tmpdir, data, corrupt_data, caplog_async): |
| 51 | rf = readfile.ReadFile() |
| 52 | with taddons.context(rf) as tctx: |
| 53 | assert not rf.reading() |
| 54 | |
| 55 | tf = tmpdir.join("tfile") |
| 56 | |
| 57 | load_called = asyncio.Event() |
| 58 | |
| 59 | async def load_flow(*_, **__): |
| 60 | load_called.set() |
| 61 | |
| 62 | tctx.master.load_flow = load_flow |
| 63 | |
| 64 | tf.write(data.getvalue()) |
| 65 | tctx.configure(rf, rfile=str(tf), readfile_filter=".*") |
| 66 | assert not load_called.is_set() |
| 67 | rf.running() |
| 68 | await load_called.wait() |
| 69 | |
| 70 | while rf.reading(): |
| 71 | await asyncio.sleep(0) |
| 72 | |
| 73 | tf.write(corrupt_data.getvalue()) |
| 74 | tctx.configure(rf, rfile=str(tf)) |
| 75 | rf.running() |
| 76 | await caplog_async.await_log("corrupted") |
| 77 | |
| 78 | async def test_corrupt(self, corrupt_data, caplog_async): |
| 79 | rf = readfile.ReadFile() |