Skip to content

Commit 4a84d8a

Browse files
GWealecopybara-github
authored andcommitted
test: preserve YAML fixture newlines
Two CLI builder-response tests wrote YAML fixtures with Path.write_text(), which on Windows translates newlines and changes the asserted payload. This writes the exact fixture bytes so the tests are stable across platforms; production behavior is unchanged and the endpoint still preserves file bytes. Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 949184681
1 parent 4e16855 commit 4a84d8a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tests/unittests/cli/test_fast_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2605,10 +2605,10 @@ def test_builder_cancel_deletes_tmp_idempotent(builder_test_client, tmp_path):
26052605
def test_builder_get_tmp_true_recreates_tmp(builder_test_client, tmp_path):
26062606
app_root = tmp_path / "app"
26072607
app_root.mkdir(parents=True, exist_ok=True)
2608-
(app_root / "root_agent.yaml").write_text("name: app\n")
2608+
(app_root / "root_agent.yaml").write_bytes(b"name: app\n")
26092609
nested_dir = app_root / "nested"
26102610
nested_dir.mkdir(parents=True, exist_ok=True)
2611-
(nested_dir / "nested.yaml").write_text("nested: true\n")
2611+
(nested_dir / "nested.yaml").write_bytes(b"nested: true\n")
26122612

26132613
assert not (app_root / "tmp").exists()
26142614
response = builder_test_client.get("/dev/apps/app/builder?tmp=true")
@@ -2766,8 +2766,8 @@ def test_builder_get_allows_yaml_file_paths(builder_test_client, tmp_path):
27662766
"""GET /dev/apps/{app_name}/builder?file_path=... allows YAML extensions."""
27672767
app_root = tmp_path / "app"
27682768
app_root.mkdir(parents=True, exist_ok=True)
2769-
(app_root / "sub_agent.yaml").write_text("name: sub\n")
2770-
(app_root / "tool.yml").write_text("name: tool\n")
2769+
(app_root / "sub_agent.yaml").write_bytes(b"name: sub\n")
2770+
(app_root / "tool.yml").write_bytes(b"name: tool\n")
27712771

27722772
response = builder_test_client.get(
27732773
"/dev/apps/app/builder?file_path=sub_agent.yaml"

0 commit comments

Comments
 (0)