Talip7/scikit-learn-issues-multilabel huggingface dataset:
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:
I opened https://github.com/scikit-learn/scikit-learn/pull/22824 as a demonstration of what the idea looks like. Let's wait to see what other maintainers think before opening more.

Labels: good first issue, module:test-suite, Meta-issue
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:
@ShanDeng123 https://github.com/scikit-learn/scikit-learn/pull/22824 has been merged. You may open a PR per file to address the other ones following the idea in https://github.com/scikit-learn/scikit-learn/issues/22572#issuecomment-1066284782 .

Labels: good first issue, module:test-suite, Meta-issue
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:
Working on sklearn/metrics/tests/test_classification.py

Labels: good first issue, module:test-suite, Meta-issue
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:
@thomasjpfan 
Is there an intuitive way to know which error to not expect? In some cases, the error is a bit easy to see due to the function name/surrounding statements, but I'm a bit unsure on most others.

Would it be fair to say that pytest.warns(None) generally checks for [UserWarning](https://docs.python.org/3/library/warnings.html#warning-categories) unless the surrounding statements suggest otherwise?

For example, in test_feature_agglomeration, I'd imagine that the expected warning is a UserWarning for the code below
`with pytest.warns(None) as record: 
        agglo_mean.fit(X)
    assert not [w.message for w in record]`

but I'd be lying if I said I had any confidence in that answer.

Labels: good first issue, module:test-suite, Meta-issue
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:
> Is there an intuitive way to know which error to not expect? In some cases, the error is a bit easy to see due to the function name/surrounding statements, but I'm a bit unsure on most others.

The only way to check is through `git blame`. For example, `test_feature_agglomeration` is a `DeprecationWarning`: https://github.com/scikit-learn/scikit-learn/pull/11537/

For that specific case, there is no deprecation warning anymore in the code, so I would remove the "no warnings" check all together. The PR should state the reason for removing the "no warning" check.

Labels: good first issue, module:test-suite, Meta-issue
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:
I'd like to work on this for the files in `linear_model`.

Labels: good first issue, module:test-suite, Meta-issue
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:
I will continue working on this for the files in the metrics and preprocessing folders

Labels: good first issue, module:test-suite, Meta-issue
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:
Hi, I'd like to help with the problem. From the above discussion, no one is working on sklearn/feature_extraction/tests/test_text.py, is it ok if I start to work on this file?

Labels: good first issue, module:test-suite, Meta-issue
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:
Taking care of the utils folder

Labels: good first issue, module:test-suite, Meta-issue
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:
Hello, I would like to work on `sklearn/semi_supervised/tests/test_label_propagation.py` if no one is working on it.

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