Skip to content
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

Merged
merged 2 commits into from
Apr 23, 2024

Conversation

lagru
Copy link
Member

@lagru lagru commented Mar 13, 2024

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

Release 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.

...

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..
@lagru lagru added 🔧 type: Maintenance Refactoring and maintenance of internals 🚀 Quick win Trivial, small or easy to address or review labels Mar 13, 2024
Copy link
Member

@mkcor mkcor left a 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():
Copy link
Member

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)...(?)

Copy link
Member Author

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. ^^

@lagru lagru merged commit 5468c24 into scikit-image:main Apr 23, 2024
26 checks passed
@lagru lagru deleted the replace-nose-style-setup branch April 23, 2024 12:25
@stefanv stefanv added this to the 0.24 milestone Apr 23, 2024
@lagru
Copy link
Member Author

lagru commented Apr 23, 2024

Merging since it seems there's a silent consensus and at least 2 approving maintainers. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 Quick win Trivial, small or easy to address or review 🔧 type: Maintenance Refactoring and maintenance of internals
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants