diff --git a/pandas/tests/arithmetic/conftest.py b/pandas/tests/arithmetic/conftest.py index 2714b68fa6ff4..44e6cc664de6d 100644 --- a/pandas/tests/arithmetic/conftest.py +++ b/pandas/tests/arithmetic/conftest.py @@ -154,7 +154,7 @@ def box(request): @pytest.fixture(params=[pd.Index, pd.Series, pytest.param(pd.DataFrame, - marks=pytest.mark.xfail(strict=True))], + marks=pytest.mark.xfail)], ids=id_func) def box_df_fail(request): """ @@ -167,7 +167,7 @@ def box_df_fail(request): (pd.Series, False), (pd.DataFrame, False), pytest.param((pd.DataFrame, True), - marks=pytest.mark.xfail(strict=True))], + marks=pytest.mark.xfail)], ids=id_func) def box_transpose_fail(request): """ diff --git a/pandas/tests/arithmetic/test_numeric.py b/pandas/tests/arithmetic/test_numeric.py index c3cd9f0f43559..2d26959c65632 100644 --- a/pandas/tests/arithmetic/test_numeric.py +++ b/pandas/tests/arithmetic/test_numeric.py @@ -407,7 +407,7 @@ class TestMultiplicationDivision(object): pytest.param(pd.Index, marks=pytest.mark.xfail(reason="Index.__div__ always " "raises", - raises=TypeError, strict=True)), + raises=TypeError)), pd.Series, pd.DataFrame ], ids=lambda x: x.__name__) diff --git a/pandas/tests/arithmetic/test_object.py b/pandas/tests/arithmetic/test_object.py index 511d74a2e790c..da5055cc7b737 100644 --- a/pandas/tests/arithmetic/test_object.py +++ b/pandas/tests/arithmetic/test_object.py @@ -92,7 +92,7 @@ def test_add_extension_scalar(self, other, box, op): @pytest.mark.parametrize('box', [ pytest.param(pd.Index, marks=pytest.mark.xfail(reason="Does not mask nulls", - strict=True, raises=TypeError)), + raises=TypeError)), pd.Series, pd.DataFrame ], ids=lambda x: x.__name__) @@ -109,7 +109,7 @@ def test_objarr_add_str(self, box): @pytest.mark.parametrize('box', [ pytest.param(pd.Index, marks=pytest.mark.xfail(reason="Does not mask nulls", - strict=True, raises=TypeError)), + raises=TypeError)), pd.Series, pd.DataFrame ], ids=lambda x: x.__name__) diff --git a/pandas/tests/arrays/categorical/test_constructors.py b/pandas/tests/arrays/categorical/test_constructors.py index a473f44d5d4aa..f1475c5022a86 100644 --- a/pandas/tests/arrays/categorical/test_constructors.py +++ b/pandas/tests/arrays/categorical/test_constructors.py @@ -538,8 +538,7 @@ def test_construction_with_ordered(self): cat = Categorical([0, 1, 2], ordered=True) assert cat.ordered - @pytest.mark.xfail(reason="Imaginary values not supported in Categorical", - strict=True) + @pytest.mark.xfail(reason="Imaginary values not supported in Categorical") def test_constructor_imaginary(self): values = [1, 2, 3 + 1j] c1 = Categorical(values) diff --git a/pandas/tests/arrays/sparse/test_array.py b/pandas/tests/arrays/sparse/test_array.py index 619cd05128ddb..b8cef92f6a6d4 100644 --- a/pandas/tests/arrays/sparse/test_array.py +++ b/pandas/tests/arrays/sparse/test_array.py @@ -488,7 +488,7 @@ def test_astype_all(self, any_real_dtype): SparseArray(np.array([0, 1], dtype='datetime64[ns]'), dtype=SparseDtype('datetime64[ns]', pd.Timestamp('1970'))), - marks=[pytest.mark.xfail(reason="NumPy-7619", strict=True)], + marks=[pytest.mark.xfail(reason="NumPy-7619")], ), (SparseArray([0, 1, 10]), str, SparseArray(['0', '1', '10'], dtype=SparseDtype(str, '0'))), diff --git a/pandas/tests/extension/base/ops.py b/pandas/tests/extension/base/ops.py index 2161214190be0..cd5e55d9871b2 100644 --- a/pandas/tests/extension/base/ops.py +++ b/pandas/tests/extension/base/ops.py @@ -72,8 +72,7 @@ def test_arith_series_with_scalar(self, data, all_arithmetic_operators): s = pd.Series(data) self.check_opname(s, op_name, s.iloc[0], exc=self.series_scalar_exc) - @pytest.mark.xfail(run=False, reason="_reduce needs implementation", - strict=True) + @pytest.mark.xfail(run=False, reason="_reduce needs implementation") def test_arith_frame_with_scalar(self, data, all_arithmetic_operators): # frame & scalar op_name = all_arithmetic_operators diff --git a/pandas/tests/extension/base/setitem.py b/pandas/tests/extension/base/setitem.py index 479ab71676315..5c767c28643c9 100644 --- a/pandas/tests/extension/base/setitem.py +++ b/pandas/tests/extension/base/setitem.py @@ -166,8 +166,7 @@ def test_setitem_frame_invalid_length(self, data): with pytest.raises(ValueError, match=xpr): df['B'] = data[:5] - @pytest.mark.xfail(reason="GH#20441: setitem on extension types.", - strict=True) + @pytest.mark.xfail(reason="GH#20441: setitem on extension types.") def test_setitem_tuple_index(self, data): s = pd.Series(data[:2], index=[(0, 0), (0, 1)]) expected = pd.Series(data.take([1, 1]), index=s.index) diff --git a/pandas/tests/extension/json/test_json.py b/pandas/tests/extension/json/test_json.py index a9fb22bb72497..66e5f6b6dc732 100644 --- a/pandas/tests/extension/json/test_json.py +++ b/pandas/tests/extension/json/test_json.py @@ -148,7 +148,7 @@ def test_stack(self): rows since we consider `{}` NA, but `.astype(object)` doesn't. """ - @pytest.mark.xfail(reason="dict for NA", strict=True) + @pytest.mark.xfail(reason="dict for NA") def test_unstack(self, data, index): # The base test has NaN for the expected NA value. # this matches otherwise diff --git a/pandas/tests/extension/test_categorical.py b/pandas/tests/extension/test_categorical.py index 279bfb5dc8eab..5b873b337880e 100644 --- a/pandas/tests/extension/test_categorical.py +++ b/pandas/tests/extension/test_categorical.py @@ -72,7 +72,7 @@ class TestDtype(base.BaseDtypeTests): class TestInterface(base.BaseInterfaceTests): - @pytest.mark.skip(reason="Memory usage doesn't match", strict=True) + @pytest.mark.skip(reason="Memory usage doesn't match") def test_memory_usage(self, data): # Is this deliberate? super(TestInterface, self).test_memory_usage(data) @@ -87,9 +87,9 @@ class TestReshaping(base.BaseReshapingTests): class TestGetitem(base.BaseGetitemTests): - skip_take = pytest.mark.skip(reason="GH-20664.", strict=True) + skip_take = pytest.mark.skip(reason="GH-20664.") - @pytest.mark.skip(reason="Backwards compatibility", strict=True) + @pytest.mark.skip(reason="Backwards compatibility") def test_getitem_scalar(self, data): # CategoricalDtype.type isn't "correct" since it should # be a parent of the elements (object). But don't want @@ -117,7 +117,7 @@ def test_take_non_na_fill_value(self, data_missing): def test_take_out_of_bounds_raises(self, data, allow_fill): return super().test_take_out_of_bounds_raises(data, allow_fill) - @pytest.mark.skip(reason="GH-20747. Unobserved categories.", strict=True) + @pytest.mark.skip(reason="GH-20747. Unobserved categories.") def test_take_series(self, data): super().test_take_series(data) @@ -125,12 +125,11 @@ def test_take_series(self, data): def test_reindex_non_na_fill_value(self, data_missing): super().test_reindex_non_na_fill_value(data_missing) - @pytest.mark.skip(reason="Categorical.take buggy", strict=True) + @pytest.mark.skip(reason="Categorical.take buggy") def test_take_empty(self, data, na_value, na_cmp): super().test_take_empty(data, na_value, na_cmp) - @pytest.mark.skip(reason="test not written correctly for categorical", - strict=True) + @pytest.mark.skip(reason="test not written correctly for categorical") def test_reindex(self, data, na_value): super().test_reindex(data, na_value) @@ -141,11 +140,11 @@ class TestSetitem(base.BaseSetitemTests): class TestMissing(base.BaseMissingTests): - @pytest.mark.skip(reason="Not implemented", strict=True) + @pytest.mark.skip(reason="Not implemented") def test_fillna_limit_pad(self, data_missing): super().test_fillna_limit_pad(data_missing) - @pytest.mark.skip(reason="Not implemented", strict=True) + @pytest.mark.skip(reason="Not implemented") def test_fillna_limit_backfill(self, data_missing): super().test_fillna_limit_backfill(data_missing) @@ -155,7 +154,7 @@ class TestReduce(base.BaseNoReduceTests): class TestMethods(base.BaseMethodsTests): - @pytest.mark.skip(reason="Unobserved categories included", strict=True) + @pytest.mark.skip(reason="Unobserved categories included") def test_value_counts(self, all_data, dropna): return super().test_value_counts(all_data, dropna) @@ -175,7 +174,7 @@ def test_combine_add(self, data_repeated): expected = pd.Series([a + val for a in list(orig_data1)]) self.assert_series_equal(result, expected) - @pytest.mark.skip(reason="Not Applicable", strict=True) + @pytest.mark.skip(reason="Not Applicable") def test_fillna_length_mismatch(self, data_missing): super().test_fillna_length_mismatch(data_missing) diff --git a/pandas/tests/frame/test_combine_concat.py b/pandas/tests/frame/test_combine_concat.py index 25c5222b5f03c..c60bb57625d75 100644 --- a/pandas/tests/frame/test_combine_concat.py +++ b/pandas/tests/frame/test_combine_concat.py @@ -77,8 +77,7 @@ def test_concat_multiple_tzs(self): [ '2015-01-01', pytest.param(pd.NaT, marks=pytest.mark.xfail( - reason='GH23037 incorrect dtype when concatenating', - strict=True))]) + reason='GH23037 incorrect dtype when concatenating'))]) def test_concat_tz_NaT(self, t1): # GH 22796 # Concating tz-aware multicolumn DataFrames diff --git a/pandas/tests/frame/test_duplicates.py b/pandas/tests/frame/test_duplicates.py index 3478d66b919a6..c9aff97bfa4b1 100644 --- a/pandas/tests/frame/test_duplicates.py +++ b/pandas/tests/frame/test_duplicates.py @@ -55,8 +55,7 @@ def test_duplicated_keep(keep, expected): tm.assert_series_equal(result, expected) -@pytest.mark.xfail(reason="GH#21720; nan/None falsely considered equal", - strict=True) +@pytest.mark.xfail(reason="GH#21720; nan/None falsely considered equal") @pytest.mark.parametrize('keep, expected', [ ('first', Series([False, False, True, False, True])), ('last', Series([True, True, False, False, False])), diff --git a/pandas/tests/groupby/test_apply.py b/pandas/tests/groupby/test_apply.py index 3bc5e51ca046a..8366f75a5795e 100644 --- a/pandas/tests/groupby/test_apply.py +++ b/pandas/tests/groupby/test_apply.py @@ -60,8 +60,7 @@ def test_apply_trivial(): @pytest.mark.xfail(reason="GH#20066; function passed into apply " "returns a DataFrame with the same index " - "as the one to create GroupBy object.", - strict=True) + "as the one to create GroupBy object.") def test_apply_trivial_fail(): # GH 20066 # trivial apply fails if the constant dataframe has the same index diff --git a/pandas/tests/groupby/test_categorical.py b/pandas/tests/groupby/test_categorical.py index 14a09b83e5b7c..3692d34afcc03 100644 --- a/pandas/tests/groupby/test_categorical.py +++ b/pandas/tests/groupby/test_categorical.py @@ -206,7 +206,7 @@ def test_level_get_group(observed): assert_frame_equal(result, expected) -@pytest.mark.xfail(PY37, reason="flaky on 3.7, xref gh-21636") +@pytest.mark.xfail(PY37, reason="flaky on 3.7, xref gh-21636", strict=False) @pytest.mark.parametrize('ordered', [True, False]) def test_apply(ordered): # GH 10138 diff --git a/pandas/tests/indexes/interval/test_astype.py b/pandas/tests/indexes/interval/test_astype.py index 8bcd6ef5dcc5a..8406a8c458cca 100644 --- a/pandas/tests/indexes/interval/test_astype.py +++ b/pandas/tests/indexes/interval/test_astype.py @@ -92,7 +92,7 @@ def test_subtype_integer(self, subtype_start, subtype_end): closed=index.closed) tm.assert_index_equal(result, expected) - @pytest.mark.xfail(reason='GH#15832', strict=True) + @pytest.mark.xfail(reason='GH#15832') def test_subtype_integer_errors(self): # int64 -> uint64 fails with negative values index = interval_range(-10, 10) @@ -130,7 +130,7 @@ def test_subtype_integer(self, subtype): with pytest.raises(ValueError, match=msg): index.insert(0, np.nan).astype(dtype) - @pytest.mark.xfail(reason='GH#15832', strict=True) + @pytest.mark.xfail(reason='GH#15832') def test_subtype_integer_errors(self): # float64 -> uint64 fails with negative values index = interval_range(-10.0, 10.0) diff --git a/pandas/tests/indexes/multi/test_missing.py b/pandas/tests/indexes/multi/test_missing.py index 73e6579cf7771..8ce33f100a6af 100644 --- a/pandas/tests/indexes/multi/test_missing.py +++ b/pandas/tests/indexes/multi/test_missing.py @@ -84,7 +84,7 @@ def test_nulls(idx): idx.isna() -@pytest.mark.xfail(strict=True) +@pytest.mark.xfail def test_hasnans_isnans(idx): # GH 11343, added tests for hasnans / isnans index = idx.copy() diff --git a/pandas/tests/indexes/test_base.py b/pandas/tests/indexes/test_base.py index 7028b5c23225c..fe7391ff15ebe 100644 --- a/pandas/tests/indexes/test_base.py +++ b/pandas/tests/indexes/test_base.py @@ -462,8 +462,7 @@ def test_constructor_overflow_int64(self): Index([np.iinfo(np.uint64).max - 1], dtype="int64") @pytest.mark.xfail(reason="see GH#21311: Index " - "doesn't enforce dtype argument", - strict=True) + "doesn't enforce dtype argument") def test_constructor_cast(self): msg = "could not convert string to float" with pytest.raises(ValueError, match=msg): @@ -1471,8 +1470,7 @@ def test_slice_float_locs(self): assert index2.slice_locs(8.5, 1.5) == (2, 6) assert index2.slice_locs(10.5, -1) == (0, n) - @pytest.mark.xfail(reason="Assertions were not correct - see GH#20915", - strict=True) + @pytest.mark.xfail(reason="Assertions were not correct - see GH#20915") def test_slice_ints_with_floats_raises(self): # int slicing with floats # GH 4892, these are all TypeErrors diff --git a/pandas/tests/indexing/test_coercion.py b/pandas/tests/indexing/test_coercion.py index 2bc3aefcf7eb1..29b60d80750b2 100644 --- a/pandas/tests/indexing/test_coercion.py +++ b/pandas/tests/indexing/test_coercion.py @@ -903,11 +903,12 @@ def test_replace_series_datetime_tz(self): # TODO(jreback) commented out to only have a single xfail printed @pytest.mark.xfail(reason="different tz, " - "currently mask_missing raises SystemError") + "currently mask_missing raises SystemError", + strict=False) # @pytest.mark.parametrize('how', ['dict', 'series']) # @pytest.mark.parametrize('to_key', [ - # 'datetime64[ns]', 'datetime64[ns, UTC]', - # 'datetime64[ns, US/Eastern]']) + # 'datetime64[ns]', 'datetime64[ns, UTC]', + # 'datetime64[ns, US/Eastern]']) # @pytest.mark.parametrize('from_key', [ # 'datetime64[ns]', 'datetime64[ns, UTC]', # 'datetime64[ns, US/Eastern]']) diff --git a/pandas/tests/io/formats/test_to_csv.py b/pandas/tests/io/formats/test_to_csv.py index 3792da4b29ef9..cba3f000b59c1 100644 --- a/pandas/tests/io/formats/test_to_csv.py +++ b/pandas/tests/io/formats/test_to_csv.py @@ -358,7 +358,7 @@ def test_to_csv_string_array_ascii(self): with open(path, 'r') as f: assert f.read() == expected_ascii - @pytest.mark.xfail(strict=True) + @pytest.mark.xfail def test_to_csv_string_array_utf8(self): # GH 10813 str_array = [{'names': ['foo', 'bar']}, {'names': ['baz', 'qux']}] diff --git a/pandas/tests/io/formats/test_to_html.py b/pandas/tests/io/formats/test_to_html.py index e7f87b236ef7f..ce9aca3a87c51 100644 --- a/pandas/tests/io/formats/test_to_html.py +++ b/pandas/tests/io/formats/test_to_html.py @@ -220,7 +220,7 @@ def test_to_html_truncate_multi_index(self, datapath): expected = expected_html(datapath, 'truncate_multi_index') assert result == expected - @pytest.mark.xfail(reason='GH22887 TypeError', strict=True) + @pytest.mark.xfail(reason='GH22887 TypeError') def test_to_html_truncate_multi_index_sparse_off(self, datapath): arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'], ['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']] diff --git a/pandas/tests/io/json/test_json_table_schema.py b/pandas/tests/io/json/test_json_table_schema.py index 0b4ff2c34297a..bb154de14611c 100644 --- a/pandas/tests/io/json/test_json_table_schema.py +++ b/pandas/tests/io/json/test_json_table_schema.py @@ -498,7 +498,7 @@ class TestTableOrientReader(object): None, "idx", pytest.param("index", - marks=pytest.mark.xfail(strict=True)), + marks=pytest.mark.xfail), 'level_0']) @pytest.mark.parametrize("vals", [ {'ints': [1, 2, 3, 4]}, @@ -508,7 +508,7 @@ class TestTableOrientReader(object): {'ordered_cats': pd.Series(pd.Categorical(['a', 'b', 'c', 'c'], ordered=True))}, pytest.param({'floats': [1., 2., 3., 4.]}, - marks=pytest.mark.xfail(strict=True)), + marks=pytest.mark.xfail), {'floats': [1.1, 2.2, 3.3, 4.4]}, {'bools': [True, False, False, True]}]) def test_read_json_table_orient(self, index_nm, vals, recwarn): @@ -566,7 +566,7 @@ def test_multiindex(self, index_names): tm.assert_frame_equal(df, result) @pytest.mark.parametrize("strict_check", [ - pytest.param(True, marks=pytest.mark.xfail(strict=True)), + pytest.param(True, marks=pytest.mark.xfail), False ]) def test_empty_frame_roundtrip(self, strict_check): diff --git a/pandas/tests/io/parser/test_usecols.py b/pandas/tests/io/parser/test_usecols.py index d2ec1cf49445f..068227908a285 100644 --- a/pandas/tests/io/parser/test_usecols.py +++ b/pandas/tests/io/parser/test_usecols.py @@ -520,7 +520,9 @@ def test_raises_on_usecols_names_mismatch(all_parsers, usecols, tm.assert_frame_equal(result, expected) -@pytest.mark.xfail(reason="see gh-16469: buggy behavior") +@pytest.mark.xfail( + reason="see gh-16469: works on the C engine but not the Python engine", + strict=False) @pytest.mark.parametrize("usecols", [["A", "C"], [0, 2]]) def test_usecols_subset_names_mismatch_orig_columns(all_parsers, usecols): data = "a,b,c,d\n1,2,3,4\n5,6,7,8" diff --git a/pandas/tests/io/test_excel.py b/pandas/tests/io/test_excel.py index 7cc1f1899db98..564364ea01432 100644 --- a/pandas/tests/io/test_excel.py +++ b/pandas/tests/io/test_excel.py @@ -2389,8 +2389,7 @@ def check_called(func): pytest.param('xlwt', marks=pytest.mark.xfail(reason='xlwt does not support ' 'openpyxl-compatible ' - 'style dicts', - strict=True)), + 'style dicts')), 'xlsxwriter', 'openpyxl', ]) diff --git a/pandas/tests/io/test_parquet.py b/pandas/tests/io/test_parquet.py index 6024fccb15c76..5964c44a31f48 100644 --- a/pandas/tests/io/test_parquet.py +++ b/pandas/tests/io/test_parquet.py @@ -201,8 +201,7 @@ def test_options_get_engine(fp, pa): @pytest.mark.xfail(is_platform_windows() or is_platform_mac(), - reason="reading pa metadata failing on Windows/mac", - strict=True) + reason="reading pa metadata failing on Windows/mac") def test_cross_engine_pa_fp(df_cross_compat, pa, fp): # cross-compat with differing reading/writing engines @@ -404,7 +403,8 @@ def test_basic(self, pa, df_full): check_round_trip(df, pa) # TODO: This doesn't fail on all systems; track down which - @pytest.mark.xfail(reason="pyarrow fails on this (ARROW-1883)") + @pytest.mark.xfail(reason="pyarrow fails on this (ARROW-1883)", + strict=False) def test_basic_subset_columns(self, pa, df_full): # GH18628 @@ -422,7 +422,6 @@ def test_duplicate_columns(self, pa): columns=list('aaa')).copy() self.check_error_on_write(df, pa, ValueError) - @pytest.mark.xfail(reason="failing for pyarrow < 0.11.0") def test_unsupported(self, pa): # period df = pd.DataFrame({'a': pd.period_range('2013', freq='M', periods=3)}) diff --git a/pandas/tests/plotting/test_datetimelike.py b/pandas/tests/plotting/test_datetimelike.py index b26fcf71306dd..1d6c8dc404d2b 100644 --- a/pandas/tests/plotting/test_datetimelike.py +++ b/pandas/tests/plotting/test_datetimelike.py @@ -1075,6 +1075,7 @@ def test_irreg_dtypes(self): _, ax = self.plt.subplots() _check_plot_works(df.plot, ax=ax) + @pytest.mark.xfail(reason="fails with py2.7.15", strict=False) @pytest.mark.slow def test_time(self): t = datetime(1, 1, 1, 3, 30, 0) diff --git a/pandas/tests/plotting/test_frame.py b/pandas/tests/plotting/test_frame.py index f5708b24d22b1..4e047cd44c1e2 100644 --- a/pandas/tests/plotting/test_frame.py +++ b/pandas/tests/plotting/test_frame.py @@ -488,8 +488,7 @@ def test_subplots_timeseries_y_axis(self): testdata.plot(y="text") @pytest.mark.xfail(reason='not support for period, categorical, ' - 'datetime_mixed_tz', - strict=True) + 'datetime_mixed_tz') def test_subplots_timeseries_y_axis_not_supported(self): """ This test will fail for: @@ -2557,6 +2556,7 @@ def test_errorbar_asymmetrical(self): tm.close() + # This XPASSES when tested with mpl == 3.0.1 @td.xfail_if_mpl_2_2 def test_table(self): df = DataFrame(np.random.rand(10, 3), diff --git a/pandas/tests/plotting/test_misc.py b/pandas/tests/plotting/test_misc.py index 1f0a0d6bfee95..9ae3e7fc423f4 100644 --- a/pandas/tests/plotting/test_misc.py +++ b/pandas/tests/plotting/test_misc.py @@ -61,6 +61,7 @@ def test_bootstrap_plot(self): @td.skip_if_no_mpl class TestDataFramePlots(TestPlotBase): + # This XPASSES when tested with mpl == 3.0.1 @td.xfail_if_mpl_2_2 @td.skip_if_no_scipy def test_scatter_matrix_axis(self): diff --git a/pandas/tests/plotting/test_series.py b/pandas/tests/plotting/test_series.py index e6519c7db7a7b..cc8aa2018b1a0 100644 --- a/pandas/tests/plotting/test_series.py +++ b/pandas/tests/plotting/test_series.py @@ -771,6 +771,7 @@ def test_errorbar_plot(self): with pytest.raises((TypeError, ValueError)): s.plot(yerr=s_err) + # This XPASSES when tested with mpl == 3.0.1 @td.xfail_if_mpl_2_2 def test_table(self): _check_plot_works(self.series.plot, table=True) diff --git a/pandas/tests/reshape/test_pivot.py b/pandas/tests/reshape/test_pivot.py index 69572f75fea1b..b3dd94b49e3a3 100644 --- a/pandas/tests/reshape/test_pivot.py +++ b/pandas/tests/reshape/test_pivot.py @@ -489,8 +489,7 @@ def test_pivot_with_list_like_values_nans(self, values, method): tm.assert_frame_equal(result, expected) @pytest.mark.xfail(reason='MultiIndexed unstack with tuple names fails' - 'with KeyError GH#19966', - strict=True) + 'with KeyError GH#19966') @pytest.mark.parametrize('method', [True, False]) def test_pivot_with_multiindex(self, method): # issue #17160 @@ -616,8 +615,7 @@ def test_margins_dtype(self): tm.assert_frame_equal(expected, result) @pytest.mark.xfail(reason='GH#17035 (len of floats is casted back to ' - 'floats)', - strict=True) + 'floats)') def test_margins_dtype_len(self): mi_val = list(product(['bar', 'foo'], ['one', 'two'])) + [('All', '')] mi = MultiIndex.from_tuples(mi_val, names=('A', 'B')) @@ -1102,8 +1100,7 @@ def test_pivot_table_margins_name_with_aggfunc_list(self): tm.assert_frame_equal(table, expected) @pytest.mark.xfail(reason='GH#17035 (np.mean of ints is casted back to ' - 'ints)', - strict=True) + 'ints)') def test_categorical_margins(self, observed): # GH 10989 df = pd.DataFrame({'x': np.arange(8), @@ -1118,8 +1115,7 @@ def test_categorical_margins(self, observed): tm.assert_frame_equal(table, expected) @pytest.mark.xfail(reason='GH#17035 (np.mean of ints is casted back to ' - 'ints)', - strict=True) + 'ints)') def test_categorical_margins_category(self, observed): df = pd.DataFrame({'x': np.arange(8), 'y': np.arange(8) // 4, diff --git a/pandas/tests/scalar/period/test_asfreq.py b/pandas/tests/scalar/period/test_asfreq.py index 064d1a96878c2..24f2ed88936b7 100644 --- a/pandas/tests/scalar/period/test_asfreq.py +++ b/pandas/tests/scalar/period/test_asfreq.py @@ -34,8 +34,7 @@ def test_asfreq_near_zero_weekly(self): assert week2.asfreq('D', 'S') <= per2 @pytest.mark.xfail(reason='GH#19643 period_helper asfreq functions fail ' - 'to check for overflows', - strict=True) + 'to check for overflows') def test_to_timestamp_out_of_bounds(self): # GH#19643, currently gives Timestamp('1754-08-30 22:43:41.128654848') per = Period('0001-01-01', freq='B') diff --git a/pandas/tests/scalar/period/test_period.py b/pandas/tests/scalar/period/test_period.py index 4d3aa1109c120..ddb4f89738f98 100644 --- a/pandas/tests/scalar/period/test_period.py +++ b/pandas/tests/scalar/period/test_period.py @@ -1468,7 +1468,8 @@ def test_period_immutable(): # TODO: This doesn't fail on all systems; track down which -@pytest.mark.xfail(reason="Parses as Jan 1, 0007 on some systems") +@pytest.mark.xfail(reason="Parses as Jan 1, 0007 on some systems", + strict=False) def test_small_year_parsing(): per1 = Period('0001-01-07', 'D') assert per1.year == 1 diff --git a/pandas/tests/series/test_analytics.py b/pandas/tests/series/test_analytics.py index 89d76abaf5f82..6e40324c67b59 100644 --- a/pandas/tests/series/test_analytics.py +++ b/pandas/tests/series/test_analytics.py @@ -2098,7 +2098,7 @@ def test_value_counts_with_nan(self): "dtype", ["int_", "uint", "float_", "unicode_", "timedelta64[h]", pytest.param("datetime64[D]", - marks=pytest.mark.xfail(reason="GH#7996", strict=True))] + marks=pytest.mark.xfail(reason="GH#7996"))] ) @pytest.mark.parametrize("is_ordered", [True, False]) def test_drop_duplicates_categorical_non_bool(self, dtype, is_ordered): diff --git a/pandas/tests/series/test_period.py b/pandas/tests/series/test_period.py index ce620db8d9c1b..0a86bb0b67797 100644 --- a/pandas/tests/series/test_period.py +++ b/pandas/tests/series/test_period.py @@ -64,8 +64,7 @@ def test_between(self): # --------------------------------------------------------------------- # NaT support - @pytest.mark.xfail(reason="PeriodDtype Series not supported yet", - strict=True) + @pytest.mark.xfail(reason="PeriodDtype Series not supported yet") def test_NaT_scalar(self): series = Series([0, 1000, 2000, pd._libs.iNaT], dtype='period[D]') @@ -75,8 +74,7 @@ def test_NaT_scalar(self): series[2] = val assert pd.isna(series[2]) - @pytest.mark.xfail(reason="PeriodDtype Series not supported yet", - strict=True) + @pytest.mark.xfail(reason="PeriodDtype Series not supported yet") def test_NaT_cast(self): result = Series([np.nan]).astype('period[D]') expected = Series([pd.NaT]) diff --git a/pandas/tests/series/test_rank.py b/pandas/tests/series/test_rank.py index 72d05cb4839ef..da414a577ae0b 100644 --- a/pandas/tests/series/test_rank.py +++ b/pandas/tests/series/test_rank.py @@ -222,8 +222,7 @@ def test_rank_signature(self): 'int64', marks=pytest.mark.xfail( reason="iNaT is equivalent to minimum value of dtype" - "int64 pending issue GH#16674", - strict=True)), + "int64 pending issue GH#16674")), ([NegInfinity(), '1', 'A', 'BA', 'Ba', 'C', Infinity()], 'object') ]) diff --git a/pandas/tests/sparse/frame/test_analytics.py b/pandas/tests/sparse/frame/test_analytics.py index 54e3ddbf2f1cf..2d9ccaa059a8c 100644 --- a/pandas/tests/sparse/frame/test_analytics.py +++ b/pandas/tests/sparse/frame/test_analytics.py @@ -4,8 +4,7 @@ from pandas.util import testing as tm -@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)', - strict=True) +@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)') def test_quantile(): # GH 17386 data = [[1, 1], [2, 10], [3, 100], [np.nan, np.nan]] @@ -22,8 +21,7 @@ def test_quantile(): tm.assert_sp_series_equal(result, sparse_expected) -@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)', - strict=True) +@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)') def test_quantile_multi(): # GH 17386 data = [[1, 1], [2, 10], [3, 100], [np.nan, np.nan]] diff --git a/pandas/tests/sparse/frame/test_frame.py b/pandas/tests/sparse/frame/test_frame.py index f799eab2f6406..21100e3c3ffeb 100644 --- a/pandas/tests/sparse/frame/test_frame.py +++ b/pandas/tests/sparse/frame/test_frame.py @@ -1140,7 +1140,7 @@ def test_combine_first(self, float_frame): tm.assert_sp_frame_equal(result, expected) - @pytest.mark.xfail(reason="No longer supported.", strict=True) + @pytest.mark.xfail(reason="No longer supported.") def test_combine_first_with_dense(self): # We could support this if we allow # pd.core.dtypes.cast.find_common_type to special case SparseDtype @@ -1196,8 +1196,7 @@ def test_as_blocks(self): tm.assert_frame_equal(df_blocks['Sparse[float64, nan]'], df) @pytest.mark.xfail(reason='nan column names in _init_dict problematic ' - '(GH#16894)', - strict=True) + '(GH#16894)') def test_nan_columnname(self): # GH 8822 nan_colname = DataFrame(Series(1.0, index=[0]), columns=[nan]) @@ -1314,8 +1313,7 @@ def test_numpy_func_call(self, float_frame): for func in funcs: getattr(np, func)(float_frame) - @pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH 17386)', - strict=True) + @pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH 17386)') def test_quantile(self): # GH 17386 data = [[1, 1], [2, 10], [3, 100], [nan, nan]] @@ -1331,8 +1329,7 @@ def test_quantile(self): tm.assert_series_equal(result, dense_expected) tm.assert_sp_series_equal(result, sparse_expected) - @pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH 17386)', - strict=True) + @pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH 17386)') def test_quantile_multi(self): # GH 17386 data = [[1, 1], [2, 10], [3, 100], [nan, nan]] diff --git a/pandas/tests/sparse/frame/test_indexing.py b/pandas/tests/sparse/frame/test_indexing.py index 607eb2da6ded0..e4ca3b90ff8d0 100644 --- a/pandas/tests/sparse/frame/test_indexing.py +++ b/pandas/tests/sparse/frame/test_indexing.py @@ -18,8 +18,7 @@ [np.nan, np.nan] ] ]) -@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)', - strict=True) +@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)') def test_where_with_numeric_data(data): # GH 17386 lower_bound = 1.5 @@ -52,8 +51,7 @@ def test_where_with_numeric_data(data): 0.1, 100.0 + 100.0j ]) -@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)', - strict=True) +@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)') def test_where_with_numeric_data_and_other(data, other): # GH 17386 lower_bound = 1.5 @@ -70,8 +68,7 @@ def test_where_with_numeric_data_and_other(data, other): tm.assert_sp_frame_equal(result, sparse_expected) -@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)', - strict=True) +@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)') def test_where_with_bool_data(): # GH 17386 data = [[False, False], [True, True], [False, False]] @@ -94,8 +91,7 @@ def test_where_with_bool_data(): 0.1, 100.0 + 100.0j ]) -@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)', - strict=True) +@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)') def test_where_with_bool_data_and_other(other): # GH 17386 data = [[False, False], [True, True], [False, False]] diff --git a/pandas/tests/sparse/series/test_indexing.py b/pandas/tests/sparse/series/test_indexing.py index 998285d933492..989cf3b974560 100644 --- a/pandas/tests/sparse/series/test_indexing.py +++ b/pandas/tests/sparse/series/test_indexing.py @@ -18,8 +18,7 @@ np.nan, np.nan ] ]) -@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)', - strict=True) +@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)') def test_where_with_numeric_data(data): # GH 17386 lower_bound = 1.5 @@ -70,8 +69,7 @@ def test_where_with_numeric_data_and_other(data, other): tm.assert_sp_series_equal(result, sparse_expected) -@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)', - strict=True) +@pytest.mark.xfail(reason='Wrong SparseBlock initialization (GH#17386)') def test_where_with_bool_data(): # GH 17386 data = [False, False, True, True, False, False] diff --git a/pandas/tests/test_downstream.py b/pandas/tests/test_downstream.py index abcfa4b320b22..1d17b514a5b67 100644 --- a/pandas/tests/test_downstream.py +++ b/pandas/tests/test_downstream.py @@ -101,7 +101,7 @@ def test_pandas_gbq(df): pandas_gbq = import_module('pandas_gbq') # noqa -@pytest.mark.xfail(reason="0.7.0 pending", strict=True) +@pytest.mark.xfail(reason="0.7.0 pending") @tm.network def test_pandas_datareader(): diff --git a/pandas/tests/test_window.py b/pandas/tests/test_window.py index 31ea5c11f5bd1..b53aca2c9852b 100644 --- a/pandas/tests/test_window.py +++ b/pandas/tests/test_window.py @@ -695,8 +695,7 @@ def test_numpy_compat(self, method): 'expander', [1, pytest.param('ls', marks=pytest.mark.xfail( reason='GH#16425 expanding with ' - 'offset not supported', - strict=True))]) + 'offset not supported'))]) def test_empty_df_expanding(self, expander): # GH 15819 Verifies that datetime and integer expanding windows can be # applied to empty DataFrames diff --git a/pandas/tests/tseries/offsets/test_offsets_properties.py b/pandas/tests/tseries/offsets/test_offsets_properties.py index a1b68d34f4e18..cd5f2a2a25e58 100644 --- a/pandas/tests/tseries/offsets/test_offsets_properties.py +++ b/pandas/tests/tseries/offsets/test_offsets_properties.py @@ -72,7 +72,7 @@ def test_on_offset_implementations(dt, offset): assert offset.onOffset(dt) == (compare == dt) -@pytest.mark.xfail(strict=True) +@pytest.mark.xfail @given(gen_yqm_offset, gen_date_range) def test_apply_index_implementations(offset, rng): # offset.apply_index(dti)[i] should match dti[i] + offset @@ -94,7 +94,7 @@ def test_apply_index_implementations(offset, rng): # TODO: Check randomly assorted entries, not just first/last -@pytest.mark.xfail(strict=True) +@pytest.mark.xfail @given(gen_yqm_offset) def test_shift_across_dst(offset): # GH#18319 check that 1) timezone is correctly normalized and diff --git a/pandas/util/_test_decorators.py b/pandas/util/_test_decorators.py index 3f8332ade4487..0331661c3131f 100644 --- a/pandas/util/_test_decorators.py +++ b/pandas/util/_test_decorators.py @@ -158,7 +158,8 @@ def decorated_func(func): skip_if_mpl = pytest.mark.skipif(not _skip_if_no_mpl(), reason="matplotlib is present") xfail_if_mpl_2_2 = pytest.mark.xfail(_skip_if_mpl_2_2(), - reason="matplotlib 2.2") + reason="matplotlib 2.2", + strict=False) skip_if_32bit = pytest.mark.skipif(is_platform_32bit(), reason="skipping for 32 bit") skip_if_windows = pytest.mark.skipif(is_platform_windows(), diff --git a/setup.cfg b/setup.cfg index b9994e9ea0b2c..6c1f09555df1c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -106,6 +106,7 @@ markers = clipboard: mark a pd.read_clipboard test doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL addopts = --strict-data-files +xfail_strict = True [coverage:run] branch = False