diff --git a/pandas/_testing/_warnings.py b/pandas/_testing/_warnings.py index 016d958c973a7..b78cfd3fb39fb 100644 --- a/pandas/_testing/_warnings.py +++ b/pandas/_testing/_warnings.py @@ -149,6 +149,7 @@ def _assert_caught_no_extra_warnings( if _is_unexpected_warning(actual_warning, expected_warning): # GH 44732: Don't make the CI flaky by filtering SSL-related # ResourceWarning from dependencies + # GH#38630 pytest.filterwarnings does not suppress these. unclosed_ssl = ( "unclosed transport Index: def index(self, request): return request.param - @pytest.mark.xfail(reason="Goes through a generate_range path") - def test_pickle_compat_construction(self): - super().test_pickle_compat_construction() - def test_where(self): # This is handled in test_indexing pass diff --git a/pandas/tests/indexes/test_base.py b/pandas/tests/indexes/test_base.py index b383381d9a5c5..72d654f6cfa28 100644 --- a/pandas/tests/indexes/test_base.py +++ b/pandas/tests/indexes/test_base.py @@ -816,14 +816,17 @@ def test_isin_nan_common_object(self, request, nulls_fixture, nulls_fixture2): ) def test_isin_nan_common_float64(self, request, nulls_fixture): - if nulls_fixture is pd.NaT: - pytest.skip("pd.NaT not compatible with Float64Index") - # Float64Index overrides isin, so must be checked separately - if nulls_fixture is pd.NA: - request.node.add_marker( - pytest.mark.xfail(reason="Float64Index cannot contain pd.NA") - ) + if nulls_fixture is pd.NaT or nulls_fixture is pd.NA: + # Check 1) that we cannot construct a Float64Index with this value + # and 2) that with an NaN we do not have .isin(nulls_fixture) + msg = "data is not compatible with Float64Index" + with pytest.raises(ValueError, match=msg): + Float64Index([1.0, nulls_fixture]) + + idx = Float64Index([1.0, np.nan]) + assert not idx.isin([nulls_fixture]).any() + return idx = Float64Index([1.0, nulls_fixture]) res = idx.isin([np.nan]) diff --git a/pandas/tests/io/parser/common/test_chunksize.py b/pandas/tests/io/parser/common/test_chunksize.py index 4c26047d98acc..05260a74fcd8b 100644 --- a/pandas/tests/io/parser/common/test_chunksize.py +++ b/pandas/tests/io/parser/common/test_chunksize.py @@ -176,7 +176,7 @@ def test_chunks_have_consistent_numerical_type(all_parsers): assert result.a.dtype == float -def test_warn_if_chunks_have_mismatched_type(all_parsers, request): +def test_warn_if_chunks_have_mismatched_type(all_parsers): warning_type = None parser = all_parsers size = 10000 @@ -193,24 +193,8 @@ def test_warn_if_chunks_have_mismatched_type(all_parsers, request): buf = StringIO(data) - try: - with tm.assert_produces_warning(warning_type): - df = parser.read_csv(buf) - except AssertionError as err: - # 2021-02-21 this occasionally fails on the CI with an unexpected - # ResourceWarning that we have been unable to track down, - # see GH#38630 - if "ResourceWarning" not in str(err) or parser.engine != "python": - raise - - # Check the main assertion of the test before re-raising - assert df.a.dtype == object - - mark = pytest.mark.xfail( - reason="ResourceWarning for unclosed SSL Socket, GH#38630" - ) - request.node.add_marker(mark) - raise + with tm.assert_produces_warning(warning_type): + df = parser.read_csv(buf) assert df.a.dtype == object diff --git a/pandas/tests/io/test_html.py b/pandas/tests/io/test_html.py index f6ae5ebfdf526..d4b78d8371ede 100644 --- a/pandas/tests/io/test_html.py +++ b/pandas/tests/io/test_html.py @@ -1166,6 +1166,10 @@ def test_displayed_only(self, displayed_only, exp0, exp1): else: assert len(dfs) == 1 # Should not parse hidden table + @pytest.mark.filterwarnings( + "ignore:You provided Unicode markup but also provided a value for " + "from_encoding.*:UserWarning" + ) def test_encode(self, html_encoding_file): base_path = os.path.basename(html_encoding_file) root = os.path.splitext(base_path)[0] diff --git a/pandas/tests/plotting/test_series.py b/pandas/tests/plotting/test_series.py index 42a5df1f65aff..44fc6042ebaab 100644 --- a/pandas/tests/plotting/test_series.py +++ b/pandas/tests/plotting/test_series.py @@ -720,7 +720,7 @@ def test_custom_business_day_freq(self): _check_plot_works(s.plot) - @pytest.mark.xfail(reason="TODO: reason?") + @pytest.mark.xfail(reason="GH#24426") def test_plot_accessor_updates_on_inplace(self): ser = Series([1, 2, 3, 4]) _, ax = self.plt.subplots() diff --git a/pandas/tests/series/indexing/test_setitem.py b/pandas/tests/series/indexing/test_setitem.py index 265b9e1395b23..2722bc26c4629 100644 --- a/pandas/tests/series/indexing/test_setitem.py +++ b/pandas/tests/series/indexing/test_setitem.py @@ -658,11 +658,6 @@ def test_index_where(self, obj, key, expected, val, request): mask = np.zeros(obj.shape, dtype=bool) mask[key] = True - if obj.dtype == bool: - msg = "Index/Series casting behavior inconsistent GH#38692" - mark = pytest.mark.xfail(reason=msg) - request.node.add_marker(mark) - res = Index(obj).where(~mask, val) tm.assert_index_equal(res, Index(expected))