test(snmp): read and remove the poll test's rows in one transaction (milestone 491)
Run 8790: a select opened the session's transaction before begin(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -65,9 +65,9 @@ def test_a_poll_records_why_a_device_is_silent_and_what_another_answered(app):
|
||||
await asyncio.sleep(1.1)
|
||||
await scheduler._do_poll(app, poll=fake_poll)
|
||||
async with app.db_sessionmaker() as s:
|
||||
rows = {d.name: d for d in (await s.execute(
|
||||
select(SnmpDevice).where(SnmpDevice.name.in_([up, down])))).scalars()}
|
||||
async with s.begin():
|
||||
rows = {d.name: d for d in (await s.execute(
|
||||
select(SnmpDevice).where(SnmpDevice.name.in_([up, down])))).scalars()}
|
||||
for d in rows.values():
|
||||
await s.delete(d)
|
||||
return first, await _latest(app, up), rows
|
||||
|
||||
Reference in New Issue
Block a user