GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-93096: fix `test_mimetypes.test_guess_type_conflicting_with_mimetypes` by picnixz · Pull Request #131408 · python/cpython

Conversation

@picnixz

@picnixz picnixz commented Mar 18, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Using run_python_until_end() ignores setUpModule(). In particular, mocking mimetypes.knownfiles has no effect for the CLI tests and leads to issues on platforms defining non-standard MIME types such as macOS or openSUSE.

I think this was overlooked in #93097 and this may be the reason why finding the correct extension was tedious. Now, all platforms should support the test correctly (previously, the macOS files were still looked up as mimetypes.knownfiles was not unset for CLI tests).

  • Issue: Decide the fate of undocumented script behavior of some modules #93096

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@picnixz
fix test_mimetypes.test_guess_type_conflicting_with_mimetypes
62863a0
Using `run_python_until_end()` ignores `setUpModule()`. In particular,
mocking `mimetypes.knownfiles` has no effect for the CLI tests and
leads to issues on platforms defining non-standard MIME types such
as macOS or openSUSE.
@picnixz picnixz added the skip news label Mar 18, 2025
@picnixz
picnixz requested a review from hugovk March 18, 2025 12:04
@picnixz
picnixz requested a review from a team as a code owner March 18, 2025 12:04
@bedevere-app bedevere-app Bot added the awaiting core review label Mar 18, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Mar 18, 2025
Decide the fate of undocumented script behavior of some modules #93096
Open
4 of 27 tasks
@picnixz

picnixz commented Mar 18, 2025

Copy link
Copy Markdown
Member Author

!buildbot macOS

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Mar 18, 2025

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @picnixz for commit 62863a0 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F131408%2Fmerge

The command will test the builders whose names match following regular expression: macOS

The builders matched are:

  • x86-64 MacOS Intel NoGIL PR
  • x86-64 macOS PR
  • ARM64 MacOS M1 NoGIL PR
  • x86-64 MacOS Intel ASAN NoGIL PR
  • ARM64 MacOS M1 Refleaks NoGIL PR
  • ARM64 macOS PR
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz
remove checks for linesep
7be23f0
@picnixz

picnixz commented Mar 18, 2025

Copy link
Copy Markdown
Member Author

!buildbot macOS

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Mar 18, 2025

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @picnixz for commit 7be23f0 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F131408%2Fmerge

The command will test the builders whose names match following regular expression: macOS

The builders matched are:

  • x86-64 MacOS Intel NoGIL PR
  • x86-64 macOS PR
  • ARM64 MacOS M1 NoGIL PR
  • x86-64 MacOS Intel ASAN NoGIL PR
  • ARM64 MacOS M1 Refleaks NoGIL PR
  • ARM64 macOS PR
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hugovk
hugovk reviewed Mar 18, 2025
View reviewed changes
Comment thread Lib/mimetypes.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@picnixz
picnixz requested a review from hugovk March 23, 2025 13:05
picnixz added 3 commits March 26, 2025 10:28
@picnixz
use parser.exit() instead of print + sys.exit()
01e89c3
@picnixz
Merge remote-tracking branch 'upstream/main' into fix/test/conflictin…
60f9eeb
…g-mime-types-93096
@picnixz
fixup
1d29b5d
picnixz
picnixz commented Mar 30, 2025
View reviewed changes
Comment thread Lib/test/test_mimetypes.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@picnixz
Update Lib/test/test_mimetypes.py
eeb5635
@picnixz

picnixz commented Apr 7, 2025

Copy link
Copy Markdown
Member Author

@hugovk friendly ping (I hope we can ship it before the release as it could affect openSUSE users)

hugovk reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AA-Turner
AA-Turner reviewed Apr 8, 2025
View reviewed changes

@AA-Turner AA-Turner left a comment

Copy link
Copy Markdown
Member

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.

An alternative solution to sys.exit() with a string or the esoteric parser.exit() would just be to directly raise SystemExit, would this work?:

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/mimetypes.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/mimetypes.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

picnixz added 2 commits April 8, 2025 10:30
@picnixz
use Hugo's approach for testing mimetypes
d9d136e
@picnixz
Merge branch 'main' into fix/test/conflicting-mime-types-93096
8ba9b1d
@picnixz
picnixz requested a review from AA-Turner April 8, 2025 08:36
picnixz
picnixz commented Apr 8, 2025
View reviewed changes
Comment thread Lib/test/test_mimetypes.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@picnixz
Update Lib/test/test_mimetypes.py
b0c29fa
@picnixz

picnixz commented Apr 8, 2025

Copy link
Copy Markdown
Member Author

Mmh the CI seems to hang?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

picnixz added 2 commits April 8, 2025 10:41
@picnixz
[empty commit to trigger CI]
56bbd95
@picnixz
Merge branch 'fix/test/conflicting-mime-types-93096' of github.com:pi…
1efb979
…cnixz/cpython into fix/test/conflicting-mime-types-93096
hugovk
hugovk approved these changes Apr 8, 2025
View reviewed changes

@hugovk hugovk left a comment

Copy link
Copy Markdown
Member

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.

Thank you!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot removed the awaiting core review label Apr 8, 2025
@bedevere-app bedevere-app Bot added the awaiting merge label Apr 8, 2025
@hugovk
hugovk enabled auto-merge (squash) April 8, 2025 09:07
@picnixz

picnixz commented Apr 8, 2025

Copy link
Copy Markdown
Member Author

Ah I wanted to write the commit message :') but you beat me to it

hugovk reacted with rocket emoji
All reactions
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hugovk
hugovk merged commit 53908bd into python:main Apr 8, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Apr 8, 2025
@picnixz
picnixz deleted the fix/test/conflicting-mime-types-93096 branch April 8, 2025 09:16
@picnixz

picnixz commented Apr 8, 2025

Copy link
Copy Markdown
Member Author

Hum:

FAIL: test_invocation_error (test.test_mimetypes.CommandLineTest.test_invocation_error)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/buildbot/Library/Developer/XCTestDevices/D0521D50-377E-44CF-8CFA-3BC0FF6BF873/data/Containers/Bundle/Application/F1096A52-2582-4077-A71C-A6AFE9D885CD/iOSTestbed.app/python/lib/python3.14/test/test_mimetypes.py", line 435, in test_invocation_error
    with self.assertRaisesRegex(SystemExit, expected):
         ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
AssertionError: SystemExit not raised

This is on iOS ARM64. Let's just skip this one on this maybe.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mpkocher mpkocher mentioned this pull request Jul 14, 2025
mimetypes CLI cannot handle multiple file parameters #136507
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@hugovk hugovk hugovk approved these changes
@AA-Turner AA-Turner Awaiting requested review from AA-Turner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@picnixz @bedevere-bot @hugovk @AA-Turner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.