diff --git a/tests/unit/test_code_round_reads_backfill_statements.py b/tests/unit/test_code_round_reads_backfill_statements.py index 8b5ca13a9d7..867ad1eba01 100644 --- a/tests/unit/test_code_round_reads_backfill_statements.py +++ b/tests/unit/test_code_round_reads_backfill_statements.py @@ -227,20 +227,19 @@ async def statements(reuse_from: str) -> int: def test_a_file_write_ends_the_no_file_row_answer() -> None: - async def go() -> tuple[_Repo, list[Any]]: + async def go() -> _Repo: repo = _Repo() reads = RoundReads(repo, ORG, NS) await reads.prefetch(SOURCES, embedding_model=MODEL) - before = await reads.live_files_for_path(ORG, NS, "logo.png") + # The write comes before any read of the path: a read answered from the round + # takes the cached rows with it, and the write would have nothing to drop. await reads.insert_rows("code_files", [{"path": "logo.png"}]) - return repo, [before, await reads.live_files_for_path(ORG, NS, "logo.png")] + await reads.live_files_for_path(ORG, NS, "logo.png") + return repo - repo, (before, after) = asyncio.run(go()) - assert before == [] and after == [] - # answered from the round's read, then read after the buffered row was written - assert [c for c in repo.calls if c.startswith("live_files_for_path:")] == [ - "live_files_for_path:logo.png" - ] + repo = asyncio.run(go()) + # read from the repository, after the buffered row was written + assert "live_files_for_path:logo.png" in repo.calls assert repo.inserted == ["code_files"]