Uh oh!
There was an error while loading. Please reload this page.
gh-143866: Verify return value of pathlib write methods in tests - #143870
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Uh oh!
There was an error while loading. Please reload this page.
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
b9788213
commented
Jan 15, 2026
Ok, i am changed it. Can you add "skip news" label please? |
Uh oh!
There was an error while loading. Please reload this page.
| self.assertEqual(self.ground.readbytes(p), b'abcdefg') | ||
| # check the return value | ||
| data = b'some bytes' | ||
| self.assertEqual(len(data), p.write_bytes(data)) |
There was a problem hiding this comment.
Can we do the same here and move the check to the line 68?
There was a problem hiding this comment.
My push from another device isnt synced.
b9788213
commented
Jan 16, 2026
Why its failing? |
b727c7c to
7a8dd6fComparepicnixz
commented
Jan 18, 2026
Some flakiness I think. |
b9788213
commented
Jan 19, 2026
How? |
Uh oh!
There was an error while loading. Please reload this page.
…methods in tests (pythonGH-143870) (cherry picked from commit cb6a662) Co-authored-by: b9788213 <b9788213@gmail.com> Co-authored-by: sobolevn <mail@sobolevn.me>
Sorry, @b9788213 and @sobolevn, I could not cleanly backport this to |
GH-144029 is a backport of this pull request to the 3.14 branch. |
sobolevn
commented
Jan 19, 2026
@b9788213 can you please handle the 3.13 backport manually? |
b9788213
commented
Jan 20, 2026
Yes, but i dont how to do. |
sobolevn
commented
Jan 20, 2026
See this command here: #143870 (comment) |
b9788213
commented
Jan 20, 2026
Ok, i think i have made it succesfully. |
GH-144078 is a backport of this pull request to the 3.13 branch. |
…methods in tests (python#143870) Co-authored-by: sobolevn <mail@sobolevn.me>
Description
This PR adds assertions to ensure that
pathlib.Path.write_text()andpathlib.Path.write_bytes()correctly return the number of bytes written.Currently, the tests only verify the side effects (file content), which means a regression (like accidentally removing the
returnstatement) would go unnoticed.Linked Issue
Fixes#143866