Skip to content

tests/conftest.py: follow-up of PR #1209 (#1196) from its review: the helper's locale skip also catches 80 rows that can judge the tool under a one-byte locale, and four smaller gaps (a Windows failure, an unheld order, a triple predicate, a docstring) #1224

Open

Description

@brettheap

(lane openRepoShape-4, 2026-10-23T20:17:25Z)

Found by: RV1209, lane 4's independent review of PR #1209 (for #1196) at 13a2c58c (#1209 issuecomment-6372008636, #1209 (comment), posted 2026-10-23T18:31:45Z). It graded #1209 READY, with no MUST and no SHOULD, and left five NITs for follow-ups: N1 to N5, which are this issue's (RV1209's numbering, not #1196's N1 and N2). #1209 is READY at 13a2c58c and lands without these. This follows #1196 and #1209.

Line numbers are at 13a2c58c (#1209's head, one commit on #1185's head d193617c7, itself one commit on #1154's head 8a7828332), read from that commit for this issue and not run. #1154, #1185 and #1209 are all open drafts, each on the one before it, and none is on main, so this goes onto a branch after #1209 lands. The files are tests/conftest.py, tests/test_non_utf8_name_callers.py, tests/test_non_utf8_name_helpers.py and tests/test_adopt_plan_paths_spelled.py.

What is missing

Nothing a user can see: the tool is right in every case below. All five are about the new rows and their helpers. CI and the bench run UTF-8, and CI is Linux only (#597), so no gate sees N1 to N3 today.

What RV1209 measured (the figures are RV1209's; nothing was re-run for this issue)

  • UTF-8 (LC_ALL=C.UTF-8), the 25 files that reach the changed helpers, d193617c7 against 13a2c58cb, by test id: 1112 passed and 1 skipped, then 1117 passed and 1 skipped. The only changes are 5 new rows, absent before and passing now. Nothing that ran before skips now. The one skip is test_stdout_encoding.py's Windows default-stdout row, on both heads.
  • ASCII (LC_ALL=C PYTHONUTF8=0 PYTHONCOERCECLOCALE=0), the spelled file: 16 passed and 15 skipped, before and after.
  • Latin-1 (built with localedef -c as adopt-project.py: under a one-byte locale such as Latin-1, a clone check makes again for a plan's clone record that neither spelling names is compared with both, so it is kept and the next run reads it rather than cloning again (#1112) #1153's test_adopt_one_byte_locale.py builds one; LOCPATH, LC_ALL=en_US.ISO-8859-1, PYTHONUTF8=0), all 25 files: 988 passed, 87 failed, 38 skipped before; 915 passed, 52 failed, 151 skipped after. By id: 0 rows from passed to failed, 2 from failed to passed, 33 from failed to skipped, 80 from passed to skipped. The spelled file goes from 3 failed, 15 passed, 13 skipped to 0 failed, 17 passed, 14 skipped.
  • The 33 failed-to-skipped rows were each read: every one fails on its own UTF-8 premise (a name holding 0xE9 or 0xFF is Latin-1 text there, so the tool prints it or goes on with it; a U+FFFD is escaped by a Latin-1 stdout; or the test's own make_source_repo cannot spell U+65E5 U+672C), not on a defect in a tool. So the skip hides no wrong tool. N1 is about the 80 rows beside them.
  • Mutants (RV1209's, one worktree each at the head): G1 (locale question removed), G2 (comparison inverted), G3 (locale asked after the disk probe), G5 (narrower skip), F1, F2, E1, E3 and E4 each fail at least one row. G6 (os.fsdecode(os.fsencode(NOT_UTF_8_PROBE))) survives and is equivalent. G4 (the locale asked BEFORE the system's os.fsencode question) survives on Linux: that is N3.

N1 (NIT): under a one-byte locale the shared helper's new skip also catches 80 rows that passed there and can judge the tool

skip_where_a_name_cannot_be_not_utf_8 (tests/conftest.py, about :1163) now also skips where os.fsdecode(b"\xff") != NOT_UTF_8_PROBE. Under Latin-1 that skips 80 rows that passed there before #1209 (RV1209 gave a 35 and 45 split):

N2 (NIT): the new Latin-1 helper row fails on a real Windows

test_a_locale_that_reads_the_byte_as_a_character_skips_before_the_disk (tests/test_non_utf8_name_helpers.py, about :210) is not LINUX_ONLY and patches only os.fsdecode (with fsdecode_in("iso8859-1")). On Windows the helper's first question, os.fsencode, skips first. RV1209 emulated it with os.fsencode = windows_fsencode and the row's Latin-1 fsdecode: the reason is then "this system's os.fsencode makes no byte of a surrogate...", which holds no 0xFF, so assert "0xFF" in reason fails.

  • Why only a NIT. CI is Linux only (ci: run the test suite on Linux only #597), but this file is written to hold the Windows answers too.
  • Change, RV1209's: in that row, also patch os.fsencode with a POSIX one, lambda name: name if isinstance(name := os.fspath(name), bytes) else name.encode("utf-8", "surrogateescape"). Or skip the row where len(os.fsencode(NOT_UTF_8_PROBE)) != 1.

N3 (NIT): no row holds that the locale is asked after the system's question

G4 (the two questions swapped) survives on Linux. On Windows, os.fsdecode is UTF-8 with surrogatepass, and b"\xff".decode("utf-8", "surrogatepass") raises UnicodeDecodeError. With Windows' os.fsencode and os.fsdecode both emulated, the head's helper skips on the os.fsencode reason and G4's helper raises UnicodeDecodeError. The comment at NOT_UTF_8_BRANCH in tests/conftest.py already says os.fsdecode "raises on Windows".

  • Change, RV1209's: in test_where_fsencode_makes_three_bytes_the_disk_is_not_asked (tests/test_non_utf8_name_helpers.py, about :183), also patch os.fsdecode with Windows' one, lambda name: name if isinstance(name := os.fspath(name), str) else name.decode("utf-8", "surrogatepass"). G4 then fails there.

N4 (NIT): the two-question check is written three times

The same test, len(os.fsencode(NOT_UTF_8_PROBE)) != 1 or os.fsdecode(b"\xff") != NOT_UTF_8_PROBE, is in the callers fixture a_system_that_carries_the_byte and in the helpers file's skip_where_an_earlier_question_skips. Its two halves are also the shared helper's own first two steps, so it is written three times. A third question added to the helper later would have to be added in all three, or those rows fail again, as 28 did here (23 without the callers fixture's locale half, RV1209's F1, and 5 without the helpers guard's, F2).

  • Change, RV1209's: define one predicate in tests/conftest.py beside the helper, for example an_earlier_question_skips() -> bool, and use it from both test files (each keeps its own pytest.skip). Do it with N1's second choice only: with N1's first, the locale half leaves both copies and this has little left to name.

N5 (NIT): the new helper's docstring claims more parity than it has

the_environment_of_a_child_read_as_bytes (tests/test_adopt_plan_paths_spelled.py, about :305) says the child is started "as test_stdout_encoding.py's run_tool_bytes starts its own". run_tool_bytes (through child_environ) also sets an empty AGENT_PROTOCOL_ROOT, and this helper does not. RV1209 probed it (with SHAPE_PIN_SOURCE_OPENXDOX=/somewhere/else, Shape_Pin_Source_Mixed=/x and LANES_LANE=openRepoShape-9 set, and no GIT_* identity): at the head, apart from the stand-in gh (PATH, GH_STUB_LOG), the only key child_environ has and the helper lacks is AGENT_PROTOCOL_ROOT (<tmp>/agent-protocol there, absent here). The blanked pin sources, LANES_LANE, the four GIT_* identity names and PYTHONIOENCODING all match. It has no effect here: shape_advisory.workspace_paths is read only after a clone, and the run ends at the clone refusal. No row can see the difference.

  • Change, RV1209's: say "as run_script starts every other child", which is exact. Or add "AGENT_PROTOCOL_ROOT": str(tmp_path / "agent-protocol"), with the directory made, and keep the sentence.

Done when

See #1196, #1209, #1185, #1154, #1153, #1214 and #597.

Lane: openreposhape-4 (openRepoShape-4)

Activity

  1. added this to the v1.2.1 milestone on Oct 23, 2026
  2. brettheap commented on Nov 10, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-4, session 11c6c0ef-495a-4a05-94cf-811b7b0a1012@Eagle, 2026-11-10T20:31:16Z, for #1224

    Logged in lanes/log/openRepoShape-4.md at c91004f12df8339a660ccca8470afa7cad74c193.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#1224:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#1224"`, kept where the row or its body names `#1224`:
    1302	tests/test_bootstrap_non_utf8_branch.py and tests/test_bootstrap_branch_bytes.py: under Latin-1 four rows that expect the byte 0xFF spelled `a\\udcffb` run what judges there and skip on their premise, as each failed on a tool that is right (#1301)	fix/1301-latin1-bootstrap-branch-rows	OPEN
    1258	validate-family.py: the holder's gate escapes what its stdout cannot encode, so it passes under Latin-1 where it ended in a traceback, and 45 rows in 11 test files that cannot judge under a one-byte locale skip there on their own premise (#1214)	fix/1214-latin1-locale-tests	MERGED
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `1224` as a whole token:
       none
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions