Currently, we have several warnings raised during the tests from our side but not catched with pytest.warns:
We need to improve the code of tests by introducing
with pytest.warns(...):
# code that raises a warning
Hello, I'd like to help if I may. How much trouble do you think it would be?
@InCogNiTo124 thanks for proposing help on the issue. Well, the issue is not a big deal. Just to wrap testing code that raises warning with pytest.warns. The steps are the following:
tests/ignite/contrib/handlers/test_base_logger.py: 3 tests with warningswith pytest.warns(...):
# code that raises a warning
cd ignite
pytest tests/ignite/contrib/handlers/test_base_logger.py -vvv -k test_attach_on_custom_event
Does it sound good for you ?
It sounds really doable. I'll open a PR by tommorow
Maybe it would be better to fix the tests?
@InCogNiTo124 I'm sorry I do not understand what do you mean by fix the tests ?
In some sense, yes, we need to update tests by adding
with pytest.warns(...):
# code that raises a warning
We do not need to modify ignite/ignite code, but only ignite/tests/ignite...
Maybe it would be better to fix the tests?
@InCogNiTo124 I'm sorry I do not understand what do you mean by fix the tests ?
In some sense, yes, we need to update tests by addingwith pytest.warns(...): # code that raises a warningWe do not need to modify
ignite/ignitecode, but onlyignite/tests/ignite...
Yes of course, I was confused for a bit, sorry. It's just that a lot of warnings are DeprecationWarnings and I was worried things will break if you ever up the dependencies.
Also, due to life, I don't think I'll be able to fix these tests until today. I hope next week is not too late?
@InCogNiTo124 no worries. This issue is not related to coming release, so, it can wait.
Although this issue is connected with tests, I found one line in the source connected to 66 warnings in 48 tests. ignite/metrics/accumulation.py:L57 creates a tensor with value 0.0 but dtype torch.long, which then throws a warning because pytorch is considering getting rid of implicit conversion with int().
Should I fix that line? The fix is trivial, but really effective, and without it I would have to manually fix a lot of lines.
@InCogNiTo124 yes, sounds good !
Most helpful comment
It sounds really doable. I'll open a PR by tommorow