-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
MNT Use pytest --import-mode=importlib #31209
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
MNT Use pytest --import-mode=importlib #31209
Conversation
So the pytest assertion rewriting seems to work in all CI with this change I added a broken test on purpose see build log
Without
Note that in my broken test the additional info is not very useful but in general can be a lot more useful e.g. something like this:
An historical case where pytest assertion rewriting was useful: #30315 (comment). An example where it was annoying not to have it: #29253 (comment). |
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.
LGTM
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.
LGTM. I was wondering if the asserts were always like this but then I thought it was my memory playing with me. It was not apprently :) thx for the fix
This would get pytest assertion rewriting back with meson editable install after @fcharras's investigation of mesonbuild/meson-python#646.
--import-mode=importlib
is what pytest recommends see their doc. The defaultprepend
is an historical thing that they don't recommend and they probably don't want to change the default to not break backward-compatibility.The recommendation was already the case for our minimum pytest version see 7.1.x doc.
This seems to be working fine locally, let's see what the CI has to say about it.