pytest warnings due to deprecation of pytest.warns(None)

Pytest issues warnings about using `pytest.warns(None)` context manager, where the `None` part is now being deprecated. 

For example,
```>>> pytest ./sklearn/tests/test_naive_bayes.py ```
results in `79 passed, 4 warnings`. After commenting out `--disable-pytest-warnings` key in `[tool:pytest]` section of `setup.cfg`, I could see that _some_ of the warnings are:

> PytestRemovedIn8Warning: Passing None has been deprecated.
See https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.

Apparently, `pytest.warns(None)` is deprecated for being widely misunderstood. I think that while sklearn's tests do _not_ suffer from this misunderstanding, they might be affected in the future if and when pytest raises an error instead of a deprecation warning. (I couldn't figure out if this is planned for pytest's future releases, but in any case, avoiding the deprecation and reducing the warnings count won't harm.)

I found [this message ](https://github.com/pytest-dev/pytest/issues/9404#issuecomment-991051965), which is relevant to how `pytest.warns(None)` is used in scikit-learn tests, and how this could be changed. I opened this issue to share this information and quote the message, as it may save someone time in the future.

> The tests were of the form:
> 
> ```
> with pytest.warns(None) as record:
>     <do some stuff>
>     <check record for warnings, and possibly raise an error>
> ```
> 
> The tests were not assuming that the pytest context code would raise an error if a warning occurred. Instead, these tests were doing their own error checking based on `record`. So they were really using `pytest.warns(None)` exactly like `warnings.catch_warnings(record=True)`. (There is a [pull request](https://github.com/scipy/scipy/pull/15192) to make the change to `catch_warnings`.)

COMMENT:
Here is a list of files containing `pytest.warns(None)`.
For those willing to address this issue, please **fix only one file per pull request**.

- [x] sklearn/cluster/tests/test_affinity_propagation.py: #22824
- [x] sklearn/cluster/tests/test_feature_agglomeration.py: #22871
- [x] sklearn/cluster/tests/test_optics.py:
- [x] sklearn/cross_decomposition/tests/test_pls.py:
- [x] sklearn/decomposition/tests/test_dict_learning.py: #22845
- [x] sklearn/decomposition/tests/test_fastica.py: #22846
- [x] sklearn/decomposition/tests/test_kernel_pca.py: https://github.com/scikit-learn/scikit-learn/pull/22872
- [x] sklearn/decomposition/tests/test_pca.py: https://github.com/scikit-learn/scikit-learn/pull/22873
- [x] sklearn/ensemble/tests/test_iforest.py: #22874
- [x] sklearn/ensemble/tests/test_voting.py: #22949
- [x] sklearn/feature_extraction/tests/test_text.py: #22962
- [x] sklearn/feature_selection/tests/test_feature_select.py:
- [x] sklearn/feature_selection/tests/test_from_model.py:
- [x] sklearn/gaussian_process/tests/test_gpc.py: #22960
- [x] sklearn/gaussian_process/tests/test_gpr.py: #22959
- [x] sklearn/impute/tests/test_impute.py:
- [x] sklearn/inspection/_plot/tests/test_plot_partial_dependence.py:
- [x] sklearn/linear_model/tests/test_base.py: https://github.com/scikit-learn/scikit-learn/pull/22876
- [x] sklearn/linear_model/tests/test_coordinate_descent.py: https://github.com/scikit-learn/scikit-learn/pull/22878
- [x] sklearn/linear_model/tests/test_least_angle.py: #22889
- [x] sklearn/linear_model/tests/test_logistic.py: #22877
- [x] sklearn/linear_model/tests/test_omp.py: https://github.com/scikit-learn/scikit-learn/pull/22886
- [x] sklearn/linear_model/tests/test_ridge.py: #22917
- [x] sklearn/manifold/tests/test_t_sne.py:
- [x] sklearn/metrics/cluster/tests/test_supervised.py: #22955
- [x] sklearn/metrics/cluster/tests/test_unsupervised.py: #22956
- [x] sklearn/metrics/tests/test_classification.py: #22888
- [x] sklearn/metrics/tests/test_pairwise.py: #22957
- [x] sklearn/preprocessing/tests/test_common.py: #22938
- [x] sklearn/preprocessing/tests/test_data.py:
- [x] sklearn/preprocessing/tests/test_function_transformer.py:
- [x] sklearn/semi_supervised/tests/test_label_propagation.py:
- [x] sklearn/svm/tests/test_svm.py:
- [x] sklearn/tests/test_base.py:
- [x] sklearn/tests/test_common.py:
- [x] sklearn/tests/test_discriminant_analysis.py: https://github.com/scikit-learn/scikit-learn/pull/23057
- [x] sklearn/tests/test_isotonic.py:
- [x] sklearn/tests/test_naive_bayes.py:
- [x] sklearn/tests/test_pipeline.py:
- [x] sklearn/utils/tests/test_utils.py:
- [x] sklearn/utils/tests/test_validation.py:

I guess solving this issue will also move forward #22396.

Labels: good first issue, module:test-suite, Meta-issue