diff --git a/pandas/tests/arrays/sparse/test_array.py b/pandas/tests/arrays/sparse/test_array.py index 9b78eb345e188..b2fa4d72a355c 100644 --- a/pandas/tests/arrays/sparse/test_array.py +++ b/pandas/tests/arrays/sparse/test_array.py @@ -1,5 +1,4 @@ import re -import warnings import numpy as np import pytest @@ -138,12 +137,9 @@ def test_pickle(self, fix, request): def test_generator_warnings(self): sp_arr = SparseArray([1, 2, 3]) - with warnings.catch_warnings(record=True) as w: - warnings.filterwarnings(action="always", category=DeprecationWarning) - warnings.filterwarnings(action="always", category=PendingDeprecationWarning) + with tm.assert_produces_warning(None): for _ in sp_arr: pass - assert len(w) == 0 def test_where_retain_fill_value(self): # GH#45691 don't lose fill_value on _where diff --git a/pandas/tests/computation/test_eval.py b/pandas/tests/computation/test_eval.py index 571bf92870ab7..e1cd32dc09826 100644 --- a/pandas/tests/computation/test_eval.py +++ b/pandas/tests/computation/test_eval.py @@ -1362,7 +1362,6 @@ def test_query_inplace(self): tm.assert_dict_equal(df, expected) @pytest.mark.parametrize("invalid_target", [1, "cat", [1, 2], np.array([]), (1, 3)]) - @pytest.mark.filterwarnings("ignore::FutureWarning") def test_cannot_item_assign(self, invalid_target): msg = "Cannot assign expression output to target" expression = "a = 1 + 2" diff --git a/pandas/tests/frame/test_repr_info.py b/pandas/tests/frame/test_repr_info.py index fbe5500398f74..702c4a505a06a 100644 --- a/pandas/tests/frame/test_repr_info.py +++ b/pandas/tests/frame/test_repr_info.py @@ -3,7 +3,6 @@ timedelta, ) from io import StringIO -import warnings import numpy as np import pytest @@ -206,9 +205,6 @@ def test_repr_big(self): def test_repr_unsortable(self, float_frame): # columns are not sortable - warn_filters = warnings.filters - warnings.filterwarnings("ignore", category=FutureWarning, module=".*format") - unsortable = DataFrame( { "foo": [1] * 50, @@ -231,8 +227,6 @@ def test_repr_unsortable(self, float_frame): tm.reset_display_options() - warnings.filters = warn_filters - def test_repr_unicode(self): uval = "\u03c3\u03c3\u03c3\u03c3" diff --git a/pandas/tests/frame/test_ufunc.py b/pandas/tests/frame/test_ufunc.py index 3769bd22eeddb..611e0eeb3e5f0 100644 --- a/pandas/tests/frame/test_ufunc.py +++ b/pandas/tests/frame/test_ufunc.py @@ -4,7 +4,6 @@ import numpy as np import pytest -from pandas.compat.numpy import np_version_gte1p22 import pandas.util._test_decorators as td import pandas as pd @@ -264,12 +263,6 @@ def test_alignment_deprecation_many_inputs(request): vectorize, ) - if np_version_gte1p22: - mark = pytest.mark.filterwarnings( - "ignore:`np.MachAr` is deprecated.*:DeprecationWarning" - ) - request.node.add_marker(mark) - @vectorize([float64(float64, float64, float64)]) def my_ufunc(x, y, z): return x + y + z diff --git a/pandas/tests/indexes/multi/test_formats.py b/pandas/tests/indexes/multi/test_formats.py index 238a3e78169a8..c3f6e1d88faba 100644 --- a/pandas/tests/indexes/multi/test_formats.py +++ b/pandas/tests/indexes/multi/test_formats.py @@ -1,5 +1,3 @@ -import warnings - import numpy as np import pytest @@ -23,15 +21,11 @@ def test_format_integer_names(): def test_format_sparse_config(idx): - warn_filters = warnings.filters - warnings.filterwarnings("ignore", category=FutureWarning, module=".*format") # GH1538 with pd.option_context("display.multi_sparse", False): result = idx.format() assert result[1] == "foo two" - warnings.filters = warn_filters - def test_format_sparse_display(): index = MultiIndex( diff --git a/pandas/tests/io/formats/test_format.py b/pandas/tests/io/formats/test_format.py index 28590f040b8da..a75b2a427a80a 100644 --- a/pandas/tests/io/formats/test_format.py +++ b/pandas/tests/io/formats/test_format.py @@ -171,7 +171,6 @@ def has_expanded_repr(df): return False -@pytest.mark.filterwarnings("ignore::FutureWarning:.*format") class TestDataFrameFormatting: def test_eng_float_formatter(self, float_frame): df = float_frame diff --git a/pandas/tests/io/parser/test_parse_dates.py b/pandas/tests/io/parser/test_parse_dates.py index c366613c2815f..9a33fe427b853 100644 --- a/pandas/tests/io/parser/test_parse_dates.py +++ b/pandas/tests/io/parser/test_parse_dates.py @@ -10,7 +10,6 @@ timezone, ) from io import StringIO -import warnings from dateutil.parser import parse as du_parse from hypothesis import given @@ -1751,11 +1750,9 @@ def test_hypothesis_delimited_date( ) date_string = test_datetime.strftime(date_format.replace(" ", delimiter)) - with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=UserWarning) - except_out_dateutil, result = _helper_hypothesis_delimited_date( - parse_datetime_string, date_string, dayfirst=dayfirst - ) + except_out_dateutil, result = _helper_hypothesis_delimited_date( + parse_datetime_string, date_string, dayfirst=dayfirst + ) except_in_dateutil, expected = _helper_hypothesis_delimited_date( du_parse, date_string, diff --git a/pandas/tests/io/pytables/__init__.py b/pandas/tests/io/pytables/__init__.py index c94db30adb61d..68c89658c137f 100644 --- a/pandas/tests/io/pytables/__init__.py +++ b/pandas/tests/io/pytables/__init__.py @@ -5,7 +5,6 @@ pytest.mark.filterwarnings( "ignore:a closed node found in the registry:UserWarning" ), - pytest.mark.filterwarnings(r"ignore:tostring\(\) is deprecated:DeprecationWarning"), pytest.mark.filterwarnings( r"ignore:`np\.object` is a deprecated alias.*:DeprecationWarning" ), diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py index 99b4d127e37ca..2287110b63bb6 100644 --- a/pandas/tests/test_downstream.py +++ b/pandas/tests/test_downstream.py @@ -158,10 +158,6 @@ def test_oo_optimized_datetime_index_unpickle(): # patsy needs to update their imports "ignore:Using or importing the ABCs from 'collections:DeprecationWarning" ) -@pytest.mark.filterwarnings( - # numpy 1.22 - "ignore:`np.MachAr` is deprecated.*:DeprecationWarning" -) def test_statsmodels(): statsmodels = import_module("statsmodels") # noqa:F841 diff --git a/pandas/tests/window/test_api.py b/pandas/tests/window/test_api.py index 3c9c2f5b20ae2..bc723b8ed36b8 100644 --- a/pandas/tests/window/test_api.py +++ b/pandas/tests/window/test_api.py @@ -337,7 +337,6 @@ def test_multiple_agg_funcs(func, window_size, expected_vals): tm.assert_frame_equal(result, expected) -@pytest.mark.filterwarnings("ignore:min_periods:FutureWarning") def test_dont_modify_attributes_after_methods( arithmetic_win_operators, closed, center, min_periods, step ): diff --git a/pyproject.toml b/pyproject.toml index ad87f623f56e5..385c1beb08121 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -297,11 +297,6 @@ doctest_optionflags = [ "ELLIPSIS", ] filterwarnings = [ - "error:Sparse:FutureWarning", - "error:The SparseArray:FutureWarning", - # Deprecation gives warning on import during pytest collection - "ignore:pandas.core.index is deprecated:FutureWarning:importlib", - "ignore:pandas.util.testing is deprecated:FutureWarning:importlib", # Will be fixed in numba 0.56: https://github.com/numba/numba/issues/7758 "ignore:`np.MachAr` is deprecated:DeprecationWarning:numba", ]