Skip to content

[MAINT] test html output - #6179

Merged
Remi-Gau merged 28 commits into
nilearn:mainfrom
Remi-Gau:maint/6163_test_html_output
May 20, 2026
Merged

Remi-Gau merged 28 commits into
nilearn:mainfrom
Remi-Gau:maint/6163_test_html_output

Conversation

@Remi-Gau

Copy link
Copy Markdown
Collaborator

Changes proposed in this pull request:

  • add tests to make sure that there is no regression in HTML outputs (figure, reports...)

@github-actions

Copy link
Copy Markdown
Contributor

👋 @Remi-Gau Thanks for creating a PR!

Until this PR is ready for review, you can include the [WIP] tag in its title, or leave it as a github draft.

Please make sure it is compliant with our contributing guidelines. In particular, be sure it checks the boxes listed below.

  • PR has an interpretable title.
  • PR links to Github issue with mention Closes #XXXX (see our documentation on PR structure)
  • Code is PEP8-compliant (see our documentation on coding style)
  • Changelog or what's new entry in doc/changes/latest.rst (see our documentation on PR structure)

For new features:

  • There is at least one unit test per new function / class (see our documentation on testing)
  • The new feature is demoed in at least one relevant example.

For bug fixes:

  • There is at least one test that would fail under the original bug conditions.

We will review it as quick as possible, feel free to ping us with questions if needed.

Comment thread tox.ini Resolved
@codecov

codecov Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.28%. Comparing base (7ead30a) to head (7188a07).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
nilearn/_utils/estimator_checks.py 66.66% 0 Missing and 1 partial ⚠️
nilearn/_utils/testing.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6179      +/-   ##
==========================================
- Coverage   95.53%   94.28%   -1.25%     
==========================================
  Files         307      307              
  Lines       43491    43496       +5     
  Branches     4417     4417              
==========================================
- Hits        41548    41010     -538     
- Misses       1304     1825     +521     
- Partials      639      661      +22     
Flag Coverage Δ
macos-latest_3.10_min 91.89% <88.88%> (-1.25%) ⬇️
macos-latest_3.10_plot_min 93.48% <88.88%> (-1.25%) ⬇️
macos-latest_3.10_plotting 92.64% <83.33%> (-1.25%) ⬇️
macos-latest_3.11_plotting ?
macos-latest_3.12_plotting ?
macos-latest_3.13_plotting ?
macos-latest_3.14_plotting 92.61% <83.33%> (-1.26%) ⬇️
ubuntu-latest_3.10_plotting 92.65% <83.33%> (-1.25%) ⬇️
ubuntu-latest_3.10_pytest_mpl 16.53% <61.11%> (+0.04%) ⬆️
ubuntu-latest_3.11_plotting ?
ubuntu-latest_3.12_plotting ?
ubuntu-latest_3.13_plotting ?
ubuntu-latest_3.14_plotting 92.63% <83.33%> (-1.26%) ⬇️
windows-latest_3.10_plotting 92.58% <83.33%> (-1.25%) ⬇️
windows-latest_3.11_plotting ?
windows-latest_3.12_plotting ?
windows-latest_3.13_plotting ?
windows-latest_3.14_plotting 92.55% <83.33%> (-1.25%) ⬇️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread .github/workflows/test_html.yml Resolved
@Remi-Gau

Copy link
Copy Markdown
Collaborator Author

@hndgzkn
I adapted the tests from brainsprite to check the output generated by the view_* functions and the reports

Only done for some function and one masker report for now but it could be extended.

Let me know what you think.

@hndgzkn hndgzkn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I've put some minor comments, otherwise I think it seems to be very helpful.

Shall we do it for all types of maskers, fitted and not fitted, I am not sure?

Comment thread nilearn/glm/_base.py Resolved

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would it be possible to scroll the file and save the following parts as well?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Well I wanted to try something different which was to make the height of the report higher, but it seems we cannot resize reports.
It's a bug and I opened an issue about it.
Once it is fixed, we should indeed cover the whole height of the report.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It's a bug and I opened an issue about it.

I can have a look at it if that's ok with you.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yes thanks: on that note probably worth making the report_dims of the generate_report of GLM a common parameters to all reports

I am not 100% sure but I suspect that making this resizing work will require some HTML and CSS tweaking: just a heads up

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@hndgzkn I actually managed to change the size of the viewport in the generated figures so we should be getting the entire reports now

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice solution, the images are very good now.

@Remi-Gau

Copy link
Copy Markdown
Collaborator Author

Shall we do it for all types of maskers, fitted and not fitted, I am not sure?

I would start with the fitted ones. Once we have things fixed for the report height I would add some others.

Comment thread nilearn/_utils/testing.py
"""Use as a decorator to skip tests requiring memory_profiler."""

def dummy_func():
import pytest

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

moved the pytest import local to make it possible to import this module even when pytest is not installed

@@ -0,0 +1,16 @@
const template = require('./template.js')

const VIEWPORT = { x: 0, y: 0, width: 1200, height: 750 }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

May be height could be bigger for maskers as well, non? Some seem to be cut.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yeah one of the report would then fails because if we display the whole report then there is file path displayed and obviously not the same when run locally and online so I as voluntarily keeping the viewport smaller.

@Remi-Gau

Copy link
Copy Markdown
Collaborator Author

I am going to go ahead and merge this one as it is a bit of a blocker for many other things.

@Remi-Gau
Remi-Gau marked this pull request as ready for review May 20, 2026 13:24
@Remi-Gau
Remi-Gau merged commit c5fb09c into nilearn:main May 20, 2026
41 of 45 checks passed
@Remi-Gau
Remi-Gau deleted the maint/6163_test_html_output branch May 20, 2026 13:24
@Remi-Gau Remi-Gau removed the Blocker label May 20, 2026
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 test to ensure 'stability' of HTML outputs

2 participants