From 79b27971c2ff90e6bbdc370e52f1a7a3e2d3ffca Mon Sep 17 00:00:00 2001 From: Omar Sy Date: Thu, 22 Oct 2026 10:31:55 +0200 Subject: [PATCH] fix(tests): make the render-detail fixture's message interpreter-stable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test_the_render_error_detail_is_bounded_and_names_only_the_type asserted 'division by zero' in str(exc.__cause__) but rendered {{ 1 // 0 }}, whose message on CPython 3.11 is 'integer division or modulo by zero' — the test has never passed anywhere (CI billing-locked since before #136 merged; locally failing since). Switch the fixture to true division {{ 1 / 0 }}: 'division by zero' on every CPython, so the assertion (the surfaced detail carries the TYPE only; the full reason rides the cause) no longer depends on the interpreter's exact spelling. The docstring records why true division is load-bearing. This was the only test that will be genuinely red on main the moment the Actions billing lock clears; with it fixed, main's first real CI run should be green (the other known failure — the oracle coverage guard — is an intentional drift refusal that passes at the pinned catalog commit CI checks out). --- tests/test_compose_render_sandbox.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_compose_render_sandbox.py b/tests/test_compose_render_sandbox.py index 0897cf3..104e7a5 100644 --- a/tests/test_compose_render_sandbox.py +++ b/tests/test_compose_render_sandbox.py @@ -257,10 +257,13 @@ def test_the_render_error_detail_is_bounded_and_names_only_the_type(tmp_path, expression was reading, quoted back; an unbounded length), and the manager both logs and forwards whatever the greffer returns. Interpolating str(exc) into the surfaced detail would leak that. Pinned on a failure whose message - is known and distinct from the type: ZeroDivisionError, message "integer - division by zero".""" + is known and distinct from the type: ZeroDivisionError. The fixture uses + TRUE division on purpose: `1 / 0` raises "division by zero" on every + CPython, while `1 // 0`'s message differs by version ("integer division + or modulo by zero" on 3.11) — the assertion must not depend on the + interpreter's exact spelling.""" compose = {"services": {"app": {"image": "nginx:alpine", - "environment": {"X": "{{ 1 // 0 }}"}}}} + "environment": {"X": "{{ 1 / 0 }}"}}}} with pytest.raises(compose_mod.ConfigRenderError) as exc: _render(compose, tmp_path, monkeypatch) detail = str(exc.value)