From 7c707d61f93cd497ba19c6fa31d51d7dbd0112fc Mon Sep 17 00:00:00 2001 From: Marius Ciepluch <11855163+norandom@users.noreply.github.com> Date: Tue, 24 Nov 2026 20:16:23 +0100 Subject: [PATCH] test(search-with-proof): flush the disk-bound write inside the program tests/test_search_worker.py::test_run_timeout_truncation_and_disk_bound failed on the ubuntu-26.04 runner (run 45352669096) with exit status 0, where it requires a non-zero status. The runner's Python 3.14 buffers 131072 bytes by default, so a 16 KiB write to an unclosed file is flushed only at interpreter exit, where the error is ignored. The program now closes its file, so ENOSPC surfaces on every Python version. --- tests/test_search_worker.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_search_worker.py b/tests/test_search_worker.py index 019d325a..b476a0ca 100644 --- a/tests/test_search_worker.py +++ b/tests/test_search_worker.py @@ -141,7 +141,10 @@ def test_run_timeout_truncation_and_disk_bound(tmp_path): result = worker.tool("run", {"command": ["/usr/bin/python3", "-I", "-c", 'print("x" * 20000)']}) assert result["truncated"] and len(result["stdout"]) == 16384 worker.limits["disk_bytes"] = 4096 - result = worker.tool("run", {"command": ["/usr/bin/python3", "-I", "-c", 'open("/scratch/full", "wb").write(b"x" * 16384)']}) + # Close inside the program: with a write buffer of 16 KiB or more the error surfaces only at flush, + # and an unclosed file flushed at interpreter exit leaves exit status 0. + overflow = 'with open("/scratch/full", "wb") as stream: stream.write(b"x" * 16384)' + result = worker.tool("run", {"command": ["/usr/bin/python3", "-I", "-c", overflow]}) assert result["exit_code"] != 0 assert "No space left" in result["stderr"]