bpo-31904: Fix file not exist error string by LihuaZhao · Pull Request #12646 · python/cpython (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation8 Commits3 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

LihuaZhao

The strerror return "no such file or directory" when error code is ENOENT on VxWorks, this is different from Linux, change test_tabnanny.py toVxWorks excpected string.

https://bugs.python.org/issue31904

@LihuaZhao

The strerror return "no such file or directory" when error code is ENOENT on VxWorks, this is different from Linux, change test_tabnanny.py toVxWorks excpected string.

@LihuaZhao

@LihuaZhao LihuaZhao changed the titleFix file not exist bpo-31904: Fix file not exist error string

Apr 1, 2019

@LihuaZhao

The buildbot failure doesn't matter with test_tabnanny, which already pass.

Thanks.
Lihua

vstinner

f"no such file or directory: {path!r}\n"
else:
err = f"{path!r}: I/O Error: [Errno {errno.ENOENT}] " \
f"No such file or directory: {path!r}\n"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please to use os.strerror(errno.ENOENT) to avoid the if? Something like:

            err = (f"{path!r}: I/O Error: [Errno {errno.ENOENT}] "
                  f"{os.strerror(errno.ENOENT)}: {path!r}\n")

Note: I would prefer to use parenthesis to avoid trailing "" ;-))

@@ -5,6 +5,7 @@
"""
from unittest import TestCase, mock
from unittest import mock
import sys

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: sort imports, sys goes after errno.

@@ -0,0 +1 @@
Handle VxWorks error string of ENOENT

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this NEWS entry to the Tests category. I suggest:

Fix test_tabnanny on VxWorks: adjust ENOENT error message.

@bedevere-bot

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@LihuaZhao

@LihuaZhao

I have made the requested changes; please review again.

@bedevere-bot

Thanks for making the requested changes!

@vstinner: please review the changes made to this pull request.

vstinner

@vstinner

Thanks @LihuaZhao: the change now makes the test better on all platforms, rather than introducing code specific to VxWorks! :-)

@pxinwr pxinwr deleted the fix-file-not-exist branch

July 12, 2021 09:42

Labels

tests

Tests in the Lib/test dir