pytest 8 has issues with `pytest.warns`
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 7.3k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 13
Description
Some of our tests that use pytest.warns started failing with pytest 8 which was released a few days ago.
I'm just opening this issue for reference and to add as a TODO.
https://github.com/pytorch/vision/actions/runs/7694476421/job/20965356912?pr=7990
2024-01-29T10:34:47.7500403Z FAILED test/test_extended_models.py::TestHandleLegacyInterface::test_pretrained_pos[True] - UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing `weights=ModelWeights.Sentinel`. You can also use `weights=ModelWeights.DEFAULT` to get the most up-to-date weights.
2024-01-29T10:34:47.7505456Z FAILED test/test_extended_models.py::TestHandleLegacyInterface::test_pretrained_pos[False] - UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing `weights=None`.
2024-01-29T10:34:47.7508764Z FAILED test/test_extended_models.py::TestHandleLegacyInterface::test_equivalent_behavior_weights[True-True] - UserWarning: Using 'weights' as positional parameter(s) is deprecated since 0.13 and may be removed in the future. Please use keyword parameter(s) instead.
2024-01-29T10:34:47.7511905Z FAILED test/test_extended_models.py::TestHandleLegacyInterface::test_equivalent_behavior_weights[True-False] - UserWarning: Using 'weights' as positional parameter(s) is deprecated since 0.13 and may be removed in the future. Please use keyword parameter(s) instead.
2024-01-29T10:34:47.7514909Z FAILED test/test_extended_models.py::TestHandleLegacyInterface::test_equivalent_behavior_weights[False-True] - UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.
2024-01-29T10:34:47.7517759Z FAILED test/test_extended_models.py::TestHandleLegacyInterface::test_equivalent_behavior_weights[False-False] - UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.
2024-01-29T10:34:47.7521326Z FAILED test/test_extended_models.py::TestHandleLegacyInterface::test_pretrained_deprecation[inception_v3_1] - FutureWarning: The default weight initialization of inception_v3 will be changed in future releases of torchvision. If you wish to keep the old behavior (which leads to long initialization times due to scipy/scipy#11299), please set init_weights=True.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with test/test_extended_models.py and the listed TestHandleLegacyInterface cases, running them with pytest 8 to inspect the changed pytest.warns behavior. Determine the test updates needed for the reported warnings, then confirm all affected cases pass under pytest 8.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100