From d2f9d316cffd1c896d6554500c8e46b46056d663 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Sun, 30 Aug 2026 13:19:18 -0400 Subject: [PATCH] tests: 300 comes back as "300" from a platform whose key is not an integer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The precedence test wrote `version_code=300` for all five platforms and compared the desktop's against the int it wrote. It comes back as `"300"`, because the module preserves each platform's own comparator type instead of flattening both to int — which is the behaviour the change it was testing had just introduced. A `coded()` helper now says which shape to expect and why, and the assertion runs over every non-Android platform rather than spot-checking `linux-deb`. The test caught a real inconsistency in itself precisely because it compared against a concrete value rather than round-tripping what it wrote. --- tests/test_client_dist.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/test_client_dist.py b/tests/test_client_dist.py index 7a257e9..812e04a 100644 --- a/tests/test_client_dist.py +++ b/tests/test_client_dist.py @@ -47,6 +47,16 @@ def code_for(platform_id: str): return ANDROID_CODE if BY_ID[platform_id].code_is_int else DESKTOP_CODE +def coded(platform_id: str, value: int): + """`value` in the shape that platform's sidecar carries. + + A test writing `version_code=300` gets `300` back from Android and `"300"` from + a desktop platform, because the module preserves each platform's own comparator + type rather than flattening both to int. + """ + return value if BY_ID[platform_id].code_is_int else str(value) + + @pytest.fixture(autouse=True) def _empty_baked_client(tmp_path, monkeypatch): """Point the baked-in copy at an empty directory. @@ -306,7 +316,9 @@ def test_precedence_is_decided_per_platform_not_for_the_whole_set(): place("android", version_code=99) found = releases() assert found["android"]["version_code"] == 99 - assert found["linux-deb"]["version_code"] == 300 + for platform_id in ALL_IDS: + if platform_id != "android": + assert found[platform_id]["version_code"] == coded(platform_id, 300), platform_id assert set(found) == set(ALL_IDS)