-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Replace deprecated nose style setup/teardown with autouse fixtures #7343
Conversation
methods with autouse fixtures. The nose style is no longer supported by pytest since version 7.2. https://docs.pytest.org/en/latest/deprecations.html#nose-deprecation
in rank/tests. These are called in skimage/conftest.py already and I don't see a reason to call them again in rank/tests specifically..
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.
I can see the changes are consistent, but I'm not knowledgeable enough to approve!
|
||
|
||
def setup(): | ||
@pytest.fixture(autouse=True) | ||
def _use_imread_plugin(): |
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.
Disclaimer: non-expert here 😉 Just curious, from reading the documentation you linked to, I was expecting some def setup()
to be replaced by def setup_method()
(while the fixture is recommended for replacing code using @with_setup
)...(?)
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.
Ah, I didn't know that pytest supports another approach to achieve this. 😅 Though, in this case it should be setup_module
and teardown_module
.
Looks like both approaches are valid but I feel like the fixture based one may the better known approach and is also the one recommended by pytest. And that I feel more comfortable with the fixture based approach may also be a factor. ^^
Merging since it seems there's a silent consensus and at least 2 approving maintainers. :) |
Description
Follow-up to #7340.
Pytest has deprecated nose style setup and teardown since 7.2.
https://docs.pytest.org/en/latest/deprecations.html#nose-deprecation
Checklist
./doc/examples
for new featuresRelease note
We use changelist to
compile each pull request into an item of the release notes. Please refer to
the instructions
and past release notes
for guidance and examples.