Skip to content

CLN/TST: Remove old filterwarnings #50368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions pandas/tests/arrays/sparse/test_array.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re
import warnings

import numpy as np
import pytest
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion pandas/tests/computation/test_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 0 additions & 6 deletions pandas/tests/frame/test_repr_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
timedelta,
)
from io import StringIO
import warnings

import numpy as np
import pytest
Expand Down Expand Up @@ -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,
Expand All @@ -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"

Expand Down
7 changes: 0 additions & 7 deletions pandas/tests/frame/test_ufunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions pandas/tests/indexes/multi/test_formats.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import warnings

import numpy as np
import pytest

Expand All @@ -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(
Expand Down
1 change: 0 additions & 1 deletion pandas/tests/io/formats/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 3 additions & 6 deletions pandas/tests/io/parser/test_parse_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
timezone,
)
from io import StringIO
import warnings

from dateutil.parser import parse as du_parse
from hypothesis import given
Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion pandas/tests/io/pytables/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
),
Expand Down
4 changes: 0 additions & 4 deletions pandas/tests/test_downstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion pandas/tests/window/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
):
Expand Down
5 changes: 0 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down