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

ENH: Use a fixture to close Matplotlib figures in tests #169

Merged
merged 1 commit into from
Feb 16, 2025

Conversation

jhlegarreta
Copy link
Collaborator

Use a fixture to close Matplotlib figures in tests.

Resolves #168.

@jhlegarreta jhlegarreta requested a review from oesteban February 16, 2025 12:36
@jhlegarreta
Copy link
Collaborator Author

Copy link

codecov bot commented Feb 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.38%. Comparing base (8a69b48) to head (1973f60).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #169      +/-   ##
==========================================
+ Coverage   66.04%   66.38%   +0.33%     
==========================================
  Files          25       25              
  Lines        2677     2677              
  Branches      421      421              
==========================================
+ Hits         1768     1777       +9     
+ Misses        793      788       -5     
+ Partials      116      112       -4     
Flag Coverage Δ
unittests 61.33% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@effigies
Copy link
Member

Is there a reason why there is two conftest.py files? https://github.com/nipreps/nireports/blob/main/nireports/conftest.py https://github.com/nipreps/nireports/blob/main/nireports/tests/conftest.py

It's just scoping. nireports.tests.conftest applies to nireports.tests and nireports.conftest applies to all of nireports. There's no strict need to split things up this way, although when writing fixtures, some do make sense to have a narrower scope.

@jhlegarreta
Copy link
Collaborator Author

It's just scoping. nireports.tests.conftest applies to nireports.tests and nireports.conftest applies to all of nireports. There's no strict need to split things up this way, although when writing fixtures, some do make sense to have a narrower scope.

OK. IMO having a nireports.conftest.py reads weird as a conftest.py is supposed to apply to tests.

Use a fixture to close `Matplotlib` figures in tests.

Co-authored-by: Chris Markiewicz <[email protected]>
@jhlegarreta jhlegarreta force-pushed the UseAFixtureToCloseMplFigs branch from 2ff2689 to 1973f60 Compare February 16, 2025 13:57
@effigies effigies merged commit 7320552 into nipreps:main Feb 16, 2025
16 checks passed
@jhlegarreta jhlegarreta deleted the UseAFixtureToCloseMplFigs branch February 16, 2025 14:06
@oesteban
Copy link
Member

OK. IMO having a nireports.conftest.py reads weird as a conftest.py is supposed to apply to tests.

Agreed. However we still need fixtures for doctests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add fixture to close automatically Matplotlib figures in tests
3 participants