Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/loopzero/worktree.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def task_text(wt: Path) -> str:
"or recreate the file using the handoff template at "
"https://github.com/feder-positronics/loop-zero/blob/main/core/HANDOFF.md"
)
return task.read_text()
return task.read_text(encoding="utf-8")


def base_sha(wt: Path) -> str:
Expand Down
12 changes: 6 additions & 6 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,12 +1049,12 @@ def test_pr_replaces_closed_never_merged_pr(wt: Path, gh: FakeGh, capsys) -> Non
assert run(capsys, "pr") == (0, URL + "\n", "")


def test_pr_title_prefers_human_heading(wt: Path, gh: FakeGh, capsys) -> None:
task = wt / ".loopzero" / "task.md"
task.write_text("## Objective\nx\n\n# Add the feature flag\n")
assert cli._pr_title(wt, "lz/t1") == "Add the feature flag"
task.write_text("## Objective\nonly sections\n")
assert cli._pr_title(wt, "lz/t1") == "lz/t1"
@pytest.mark.parametrize(("heading", "expected"), [("", "lz/t1"), ("\n# Zażółć gęślą jaźń\n", "Zażółć gęślą jaźń")])
def test_pr_title_prefers_human_heading(wt: Path, monkeypatch, heading, expected) -> None:
task, read_text = wt / ".loopzero" / "task.md", Path.read_text
monkeypatch.setattr(Path, "read_text", lambda path, encoding="ascii", **kw: read_text(path, encoding, **kw))
task.write_text(f"## Objective\nZażółć gęślą jaźń\n{heading}", encoding="utf-8")
assert cli._pr_title(wt, "lz/t1") == expected


@pytest.mark.parametrize("name,value", [
Expand Down
Loading