Skip to content

Commit c0f574f

Browse files
AA-Turnerhugovk
andauthored
Ensure README changes don't affect whitespace (#296)
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent 2d2cd94 commit c0f574f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

release.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,9 @@ def tweak_readme(tag: Tag, filename: str = "README.rst") -> None:
466466
print(f"Updating {filename}...", end=" ")
467467
readme = Path(filename)
468468

469-
# Update first line: "This is Python version 3.14.0 alpha 7"
469+
# Update first line: "This is Python version X.Y.Z {release_level} N"
470470
# and update length of underline in second line to match.
471-
lines = readme.read_text().splitlines()
471+
lines = readme.read_text().split("\n")
472472
this_is = f"This is Python version {tag.long_name}"
473473
underline = "=" * len(this_is)
474474
lines[0] = this_is

tests/test_release.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,11 @@ def test_tweak_readme(
110110
release.tweak_readme(tag, filename=str(readme_file))
111111

112112
# Assert
113-
original_lines = original_contents.splitlines()
114-
new_lines = readme_file.read_text().splitlines()
113+
original_lines = original_contents.split("\n")
114+
new_contents = readme_file.read_text()
115+
new_lines = new_contents.split("\n")
115116
assert new_lines[0] == expected_version
116117
assert new_lines[1] == expected_underline
117118
assert new_lines[2:] == original_lines[2:]
119+
assert original_contents.endswith("\n")
120+
assert new_contents.endswith("\n")

0 commit comments

Comments
 (0)