Skip to content

TST: Remove qt_core fixture #30398

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

Merged
merged 1 commit into from
Aug 7, 2025
Merged

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Aug 6, 2025

PR summary

It doesn't seem very useful now, since we import QtGui at the top level anyway.

PR checklist

It doesn't seem very useful now, since we import `QtGui` at the top
level anyway.
@tacaswell
Copy link
Member

Should we be going the otherway and removing the top level imports?

@QuLogic
Copy link
Member Author

QuLogic commented Aug 6, 2025

The toplevel ones set a marker to skip all tests in the file if the import isn't available. This fixture actually appears to do nothing, other than maybe deferring the import a little later. It made more sense for Qt4 vs Qt5, I think?

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

IMO the mark-on-import-error approach is cleaner than the fixture approach.

It's a little less flexible (you can't selectively skip tests), but overall if Qt is not importable likely no backend_qt tests are reasonably able to run - or a bit stronger: If Qt is not importable, we should not bother with any Qt-related tests even if that test could technically run without Qt.

@tacaswell tacaswell added this to the v3.11.0 milestone Aug 7, 2025
@tacaswell
Copy link
Member

I'll merge as I agree that the current fixture is doing nothing for us, but I am still not sure we want to have any GUI frameworks at the top level of any of the tests.

As importing is process-global thing and trying to use multiple frameworks in the same process at different times leads to weird crashes (we have a test which is "do we warn if you import multiple versions of qt bindings because it might segfault"), I think is a version of leaving Chekhov's gun on the mantel in case we do this in some other frameworks tests.

@tacaswell tacaswell merged commit d3d59e8 into matplotlib:main Aug 7, 2025
48 checks passed
@QuLogic QuLogic deleted the drop-qt_core branch August 7, 2025 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants