Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-143866: Verify return value of pathlib write methods in tests#143870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Conversation
b9788213 commented Jan 15, 2026 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
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 |
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.
Lib/test/test_pathlib/test_write.py Outdated
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do the same here and move the check to the line 68?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes i will
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fix the CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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? |
cb6a662 into python:mainUh 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. |
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