-
Notifications
You must be signed in to change notification settings - Fork 20
MAINT: Consider warnings as errors when running pytest
#157
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
base: main
Are you sure you want to change the base?
Conversation
aeacf9c to
f3842ff
Compare
pytest
ed057ad to
aa05a60
Compare
|
I would suggest not adding -Werror for the min runs. Warnings are expected with old versions. |
aa05a60 to
74ca019
Compare
|
Tried different things here:
So ran out of ideas. As for
If you have a suggestion to avoid applying the option for them, I would be happy to add it. |
74ca019 to
a540f1c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #157 +/- ##
==========================================
+ Coverage 66.45% 66.75% +0.29%
==========================================
Files 27 27
Lines 3023 3023
Branches 401 401
==========================================
+ Hits 2009 2018 +9
+ Misses 897 892 -5
+ Partials 117 113 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
You could do something like this in tox.ini: command =
pytest ... \
!min: -Werror \
{posargs:-n auto} |
0e11f80 to
5a45007
Compare
tox.ini
Outdated
| commands = | ||
| pytest --durations=20 --durations-min=1.0 --cov-report term-missing {posargs:-n auto} | ||
| pytest --durations=20 --durations-min=1.0 --cov-report term-missing \ | ||
| min,pre: -Wignore \ |
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.
This warning setting takes precedence over those in tool.pytest.ini_options. For min, we expect a lot of warnings that the older versions of the libraries we're testing of course cannot resolve. For pre, we expect many PendingDeprecationWarnings and DeprecationWarnings before our upstreams even have time to address.
|
Added to discussion for next TechMon |
a73c68f to
8744db8
Compare
|
@effigies 8744db8 is the best solution I could come up with after many trial and error attempts; the thing is working locally for me. CIs show the right command: and but py310 is failing for another reason and stopping all other executions. The issue is being raised as a warning on Do not have a fix for that. The issue with the e.g. solution in a73c68f seems to be that |
8744db8 to
4de5fca
Compare
|
The solution in 4de5fca stops all jobs whenever a warning is encountered. Ideally, we would like all CIs to run and finish independently and only then report warnings. This can be achieved if the solution in nipreps/nifreeze#40 is adopted, so I'd vote for adopting it here. BTW, the Python 3.9 min build is raising some warnings that only appear in that build: Similarly, Python 3.11 is treating an already fixed warning as an error in this PR: These two things are weird to me. |
4de5fca to
ebc9d39
Compare
pytestpytest
ebc9d39 to
c2b9d28
Compare
|
So compared to 4de5fca, ebc9d39 allows all jobs to complete, instead of cancelling the rest of the jobs when one of them fails, so it looks a better solution to me. Now,
A review from somebody else would be greatly appreciated. |
c2b9d28 to
1932993
Compare
|
In 1932993 I deliberately added a statement that would raise a warning to check whether the proposed solution would work for the rest of the builds. And the solution does work: Other CI jobs still get cancelled when some of the builds errors (the conclusion in #157 (comment) was thus inaccurate, based on the fact that all were passing), but it looks like that is not the most pressing problem now. The worrying parts are thus:
|
Consider warnings as errors when running `pytest`.
2464c6c to
4bfabed
Compare
|
@effigies Thanks for reviving this. I rebased on
and it is doing its job as we've seen:
So it should be good to go now. Edit: the comments in #157 (comment) are no longer relevant as Python 3.9 has been dropped. |
ff45a79 to
2bf79c0
Compare
Call the pandas DataFrame constructor with the same data instead of copying. Fixes: ``` nireports/tests/test_reportlets.py::test_plot_raincloud[True-v] nireports/tests/test_reportlets.py::test_plot_raincloud[False-h] nireports/tests/test_reportlets.py::test_plot_raincloud[False-v] nireports/tests/test_reportlets.py::test_plot_raincloud[True-h] /home/runner/work/nireports/nireports/nireports/reportlets/nuisance.py:1108: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy df_clip[feature] = df[feature].clip(lower=lower_limit_value, upper=upper_limit_value) ``` raised for example in: https://github.com/nipreps/nireports/actions/runs/16604968354/job/46974298946?pr=157#step:14:476
Use `set_theme` instead of `set` to set searborn properties Fixes: ``` Function `set` is deprecated in favor of `set_theme` ``` raised by the IDE.
2bf79c0 to
2859470
Compare
|
Sorry, run out of ideas to fix this: I cannot reproduce it locally. |


Consider warnings as errors when running
pytest.