Skip to content

TST: catch/suppress test warnings #41346

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
May 6, 2021
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
5 changes: 4 additions & 1 deletion pandas/tests/generic/test_finalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@
),
pytest.param(
(pd.DataFrame, frame_mi_data, operator.methodcaller("count", level="A")),
marks=not_implemented_mark,
marks=[
not_implemented_mark,
pytest.mark.filterwarnings("ignore:Using the level keyword:FutureWarning"),
],
),
pytest.param(
(pd.DataFrame, frame_data, operator.methodcaller("nunique")),
Expand Down
6 changes: 6 additions & 0 deletions pandas/tests/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
pytest.mark.filterwarnings(
"ignore:PY_SSIZE_T_CLEAN will be required.*:DeprecationWarning"
),
pytest.mark.filterwarnings(
"ignore:Block.is_categorical is deprecated:DeprecationWarning"
),
pytest.mark.filterwarnings(
r"ignore:`np\.bool` is a deprecated alias:DeprecationWarning"
),
# xlrd
pytest.mark.filterwarnings(
"ignore:This method will be removed in future versions:DeprecationWarning"
Expand Down
5 changes: 4 additions & 1 deletion pandas/tests/io/formats/style/test_highlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
DataFrame,
IndexSlice,
)
import pandas._testing as tm

pytest.importorskip("jinja2")

Expand Down Expand Up @@ -54,7 +55,9 @@ def test_highlight_minmax_basic(df, f):
}
if f == "highlight_min":
df = -df
result = getattr(df.style, f)(axis=1, color="red")._compute().ctx
with tm.assert_produces_warning(RuntimeWarning):
# All-NaN slice encountered
result = getattr(df.style, f)(axis=1, color="red")._compute().ctx
assert result == expected


Expand Down
3 changes: 3 additions & 0 deletions pandas/tests/io/pytables/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@
pytest.mark.filterwarnings(
r"ignore:`np\.object` is a deprecated alias:DeprecationWarning"
),
pytest.mark.filterwarnings(
r"ignore:`np\.bool` is a deprecated alias:DeprecationWarning"
),
]
2 changes: 1 addition & 1 deletion pandas/tests/io/pytables/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def test_convert_value(setup_path, where: str, df: DataFrame, expected: DataFram
max_widths = {"col": 1}
categorical_values = sorted(df.col.unique())
expected.col = expected.col.astype("category")
expected.col.cat.set_categories(categorical_values, inplace=True)
expected.col = expected.col.cat.set_categories(categorical_values)

with ensure_clean_path(setup_path) as path:
df.to_hdf(path, "df", format="table", min_itemsize=max_widths)
Expand Down
10 changes: 8 additions & 2 deletions pandas/tests/io/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
from io import BytesIO
import os
import pathlib
from warnings import catch_warnings
from warnings import (
catch_warnings,
filterwarnings,
)

import numpy as np
import pytest
Expand Down Expand Up @@ -36,7 +39,10 @@
_HAVE_PYARROW = False

try:
import fastparquet
with catch_warnings():
# `np.bool` is a deprecated alias...
filterwarnings("ignore", "`np.bool`", category=DeprecationWarning)
import fastparquet

_HAVE_FASTPARQUET = True
except ImportError:
Expand Down