You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The change that introduced the issue is here: #131408
There's a few friction points in that commit:
There's a bit of duplication. We're essentially iterating over a list of strings and calling a function. Try to simplify the model if possible.
There's no test coverage for the case where multiple values are provided to the command line. These tests would have caught the bug.
There's already good test coverage on guess_extension and guess_type, we can lean more on testing _main and validating stdout/stderr/exit code (this is similar to the model before the 131408 commit).
There's a bunch of test coverage that is testing argparse and not providing a ton of value. This could be deleted.
Ideally, we should try to fix these issues and simplify the code. Even if this increase the diff quite a bit.
Activity
mpkocher commentedon Jul 14, 2025
The change that introduced the issue is here: #131408
There's a few friction points in that commit:
guess_extensionandguess_type, we can lean more on testing_mainand validating stdout/stderr/exit code (this is similar to the model before the 131408 commit).Ideally, we should try to fix these issues and simplify the code. Even if this increase the diff quite a bit.
@Wulian233 Here's a few ideas that are in that direction. main...mpkocher:cpython:fix-mimetypes
Perhaps @StanFromIreland can weigh on the direction to take.
Wulian233 commentedon Jul 17, 2025
Thank you for your supplement. I will add a test case for the multiple provided values in my PR. I think the other changes are a bit too much for a bug fix. main...mpkocher:cpython:fix-mimetypes#diff-aed43839a49bace08b60186baa4b27ad69ecd6b61f928bd696b4fb670750774f
I plan to add one test in my PR. Your improvements are also looks great, perhaps they can be implemented in a new PR?
gh-136507: Fix mimetypes CLI to handle multiple file parameters (GH-1…
pythongh-136507: Fix mimetypes CLI to handle multiple file parameters (…
[3.14] gh-136507: Fix mimetypes CLI to handle multiple file parameters (
hugovk commentedon Oct 8, 2025
(Oops, sorry!)