-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
gh-116622: Make test_unzip_zipfile recognize Android error message format #124462
Conversation
Lib/test/test_shutil.py
Outdated
@@ -1909,7 +1910,7 @@ def test_unzip_zipfile(self): | |||
subprocess.check_output(zip_cmd, stderr=subprocess.STDOUT) | |||
except subprocess.CalledProcessError as exc: | |||
details = exc.output.decode(errors="replace") | |||
if 'unrecognized option: t' in details: | |||
if re.search(r'(unrecognized|invalid) option(:| --) t', details): |
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.
While this regex works, I think it would be better to be explicit about the 2 forms of the message that we know exist, rather than try to catch all possible variations and combinations. My experience has been that tests that try t be "smart" have a nasty habit of biting you when you least expect it.
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. |
Thanks for making the requested changes! @freakboy3742: please review the changes made to this pull request. |
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.
👍
Thanks @mhsmith for the PR, and @freakboy3742 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…age format (pythonGH-124462) Make test_unzip_zipfile recognize Android error message format (cherry picked from commit 461c12b) Co-authored-by: Malcolm Smith <[email protected]>
GH-124516 is a backport of this pull request to the 3.13 branch. |
The test expects the format
unrecognized option: t
, but the Android message isinvalid option -- t
.This only failed in a fairly narrow range of Android versions including API level 30. Older versions didn't include an unzip command at all, and newer versions included a version that supports the
-t
option.