Skip to content

tests: four tests and directory_named still make their own "a directory named with a byte that is not UTF-8, or skip", on any OSError, beside the shared helper #663 adds, and the test that pins make_file's UTF-8 name fails under an ASCII file-name encoding #757

Closed

Description

@brettheap

Goal: every test that needs a directory named with a byte that is not UTF-8 asks the one helper whether this system can carry it, so a full disk or a permission error fails the test instead of skipping it, and a test about a skip helper is held on the encodings CI does not have.

Filed by lane openRepoShape-5, from the writer's checklist candidates of #663's PR (#723, w663, "Four tests make their own ...") and from the fix round of that PR (w663b and rv663b, "optional, v1.1.1"). Both are tests only.

Lands after: lane 5's #663 (PR #723, fix/663-non-utf8-name-tests, head 6ba8c5d2). It adds skip_where_a_name_cannot_be_not_utf_8 to tests/conftest.py (at 6ba8c5d2:tests/conftest.py:904), which the first line below calls; main has it only in tests/test_adopt_pins.py:893 today.

Lines (path:line at main 66b230ed, except the last, which is at #723's head 6ba8c5d2)

  • Four tests and directory_named make the directory themselves and skip on ANY OSError. Read from source, not measured. Each one builds a name from bytes, calls mkdir, and turns OSError and UnicodeError into pytest.skip: tests/test_stdout_encoding.py:209-215 (b"b\xffd", os.mkdir, then a listing check), tests/test_adopt_git_reads.py:465-469 (caf and byte 0xE9, parent.mkdir(), then :471-473 skips again where git will not work there), tests/test_adopt_template_values.py:296-300, tests/test_adopt_plan_escapes.py:402-406 (the same, then :407-410) and tests/test_clone_url_bytes.py:136-152 (directory_named, six callers at :188, :204, :232, :245, :292 and :307). tests: one skip helper for names and branches that are not UTF-8, Windows guards on make_file and the --branch a\udcffb test by emulation, and the UTF-8 promise and the leg finding's role pinned (#663) #723's helper answers the same question in two steps and skips only on the two answers that mean "this system cannot carry the name": os.fsencode first (Windows) and EILSEQ second (macOS). Any other OSError is the test's own and is raised. These five skip on EACCES, ENOSPC and the rest, so a disk that fills up, or a tmp_path this user cannot write in, reads as SKIPPED where the helper's tests read it as a failure. Direction: call the helper for the question and keep each test's own second skip (git will not work under the name; the listing that shows a rewritten name). For directory_named, whose raw is any bytes, call the helper for the names that are not UTF-8 and keep its own Windows skip for a name holding a control character. tests/test_adopt_plan_escapes.py:462-468 asks the same question of a FILE (caf and byte 0xE9 plus .txt, write_bytes); it is the file twin, and tests: one skip helper for names and branches that are not UTF-8, Windows guards on make_file and the --branch a\udcffb test by emulation, and the UTF-8 promise and the leg finding's role pinned (#663) #723's make_file skip in tests/test_non_utf8_git_reads.py is its model.
  • test_make_file_writes_a_name_that_is_utf8_where_fsencode_makes_no_byte fails where the file-name encoding is ASCII (tests/test_non_utf8_git_reads.py:120-127 at 6ba8c5d2). Measured twice, by w663b at 0b1d1ddb and by rv663b at 6ba8c5d2, under PYTHONUTF8=0 LC_ALL=C PYTHONCOERCECLOCALE=0 (1 failed, 6 passed, 2 skipped): make_file cannot write caf and U+00E9 plus .yml, skips with "this filesystem cannot hold a file name that is not UTF-8: 'ascii' codec can't encode character", and the test's assert skip_message(make_file, target, ...) is None fails at :126. The neighbouring control, :130-142, already ends if reason is not None and "filesystem" in reason: pytest.skip(reason). Direction: the same two lines in this test. CI never has that encoding, so nothing is red today; a person who runs the suite under a C locale sees one failure that is not a defect.

Verify: tests/test_stdout_encoding.py, tests/test_adopt_git_reads.py, tests/test_adopt_template_values.py, tests/test_adopt_plan_escapes.py, tests/test_clone_url_bytes.py and tests/test_non_utf8_git_reads.py pass on Linux, and tests/test_non_utf8_git_reads.py passes under PYTHONUTF8=0 LC_ALL=C PYTHONCOERCECLOCALE=0. For the first line, one test per file under monkeypatch.setattr(os, "mkdir", <raises PermissionError>) that asserts a failure and not a skip, as #723's tests/test_non_utf8_name_helpers.py does for the helper itself. No Windows or macOS run: CI is Linux only (#597), so the Windows half is emulated with windows_fsencode.

Overlaps. Open branches that touch these files: fix/663-non-utf8-name-tests (#723) edits tests/conftest.py and tests/test_non_utf8_git_reads.py; fix/672-bump-leg-branch-and-push-line (#746) also edits tests/test_non_utf8_git_reads.py (three dirty-list expectations); fix/693-local-remote-dir (96ebe450) edits tests/test_clone_url_bytes.py. Nothing on origin touches tests/test_stdout_encoding.py, tests/test_adopt_git_reads.py, tests/test_adopt_template_values.py or tests/test_adopt_plan_escapes.py. A line on #459 (issuecomment 6214823552, R433 O5) says directory_named skips every bad-name test on Windows, reasoned and not run; it is a different question about the same function, so decide it with the first line here. No pinned file changes.

Parent: #461.

Milestone: v1.1.1. Tests only; nothing a user runs changes.

🤖 Generated with Claude Code

Activity

  1. added this to the v1.1.1 milestone on Oct 16, 2026
  2. brettheap commented on Oct 17, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-5, session 50cede29-ab82-4ca3-9f67-d98e1a58c8d2@Eagle, 2026-10-17T10:24:07Z, for #757

    Logged in lanes/log/openRepoShape-5.md at c1f23679ad2a49e5bb1ec7e752236858233df3b4.

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

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#757:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#757"`, kept where the row or its body names `#757`:
       none
    3. `git ls-remote --heads git@github.com:opensoft/openRepoShape` branches naming `757` 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