From a7b7a8b34c3a55bb0a188b460aedf7916f72e516 Mon Sep 17 00:00:00 2001 From: rhshadrach Date: Fri, 1 Jan 2021 13:58:26 -0500 Subject: [PATCH 1/5] TST: strictly xfail mid-test --- pandas/tests/extension/test_categorical.py | 7 +- pandas/tests/frame/test_reductions.py | 10 +- pandas/tests/frame/test_ufunc.py | 24 ++- pandas/tests/generic/test_finalize.py | 4 +- .../tests/groupby/transform/test_transform.py | 24 ++- pandas/tests/indexes/datetimes/test_ops.py | 6 +- pandas/tests/indexes/test_base.py | 6 +- pandas/tests/indexes/test_setops.py | 8 +- pandas/tests/indexing/test_coercion.py | 117 +++++++------ pandas/tests/io/excel/test_readers.py | 159 +++++++++++++----- pandas/tests/io/excel/test_style.py | 10 +- pandas/tests/io/json/test_pandas.py | 24 ++- pandas/tests/io/test_parquet.py | 10 +- pandas/tests/resample/test_time_grouper.py | 6 +- pandas/tests/series/indexing/test_where.py | 6 +- pandas/tests/series/test_arithmetic.py | 12 +- pandas/tests/tseries/offsets/test_offsets.py | 6 +- 17 files changed, 297 insertions(+), 142 deletions(-) diff --git a/pandas/tests/extension/test_categorical.py b/pandas/tests/extension/test_categorical.py index 493cb979494c8..69729940376f0 100644 --- a/pandas/tests/extension/test_categorical.py +++ b/pandas/tests/extension/test_categorical.py @@ -117,8 +117,11 @@ class TestConstructors(base.BaseConstructorsTests): class TestReshaping(base.BaseReshapingTests): - def test_concat_with_reindex(self, data): - pytest.xfail(reason="Deliberately upcast to object?") + def test_concat_with_reindex(self, request, data): + request.node.add_marker( + pytest.mark.xfail(reason="Deliberately upcast to object?") + ) + assert False class TestGetitem(base.BaseGetitemTests): diff --git a/pandas/tests/frame/test_reductions.py b/pandas/tests/frame/test_reductions.py index 196d4a0b3bb76..1c397d6a6a1b5 100644 --- a/pandas/tests/frame/test_reductions.py +++ b/pandas/tests/frame/test_reductions.py @@ -1229,13 +1229,15 @@ def test_min_max_dt64_with_NaT(self): exp = Series([pd.NaT], index=["foo"]) tm.assert_series_equal(res, exp) - def test_min_max_dt64_with_NaT_skipna_false(self, tz_naive_fixture): + def test_min_max_dt64_with_NaT_skipna_false(self, request, tz_naive_fixture): # GH#36907 tz = tz_naive_fixture if isinstance(tz, tzlocal) and is_platform_windows(): - pytest.xfail( - reason="GH#37659 OSError raised within tzlocal bc Windows " - "chokes in times before 1970-01-01" + request.node.add_marker( + pytest.mark.xfail( + reason="GH#37659 OSError raised within tzlocal bc Windows " + "chokes in times before 1970-01-01" + ) ) df = DataFrame( diff --git a/pandas/tests/frame/test_ufunc.py b/pandas/tests/frame/test_ufunc.py index 81c0dc65b4e97..8a29c2f2f89a1 100644 --- a/pandas/tests/frame/test_ufunc.py +++ b/pandas/tests/frame/test_ufunc.py @@ -24,10 +24,14 @@ def test_unary_unary(dtype): @pytest.mark.parametrize("dtype", dtypes) -def test_unary_binary(dtype): +def test_unary_binary(request, dtype): # unary input, binary output if pd.api.types.is_extension_array_dtype(dtype) or isinstance(dtype, dict): - pytest.xfail(reason="Extension / mixed with multiple outuputs not implemented.") + request.node.add_marker( + pytest.mark.xfail( + reason="Extension / mixed with multiple outputs not implemented." + ) + ) values = np.array([[-1, -1], [1, 1]], dtype="int64") df = pd.DataFrame(values, columns=["A", "B"], index=["a", "b"]).astype(dtype=dtype) @@ -55,14 +59,18 @@ def test_binary_input_dispatch_binop(dtype): @pytest.mark.parametrize("dtype_a", dtypes) @pytest.mark.parametrize("dtype_b", dtypes) -def test_binary_input_aligns_columns(dtype_a, dtype_b): +def test_binary_input_aligns_columns(request, dtype_a, dtype_b): if ( pd.api.types.is_extension_array_dtype(dtype_a) or isinstance(dtype_a, dict) or pd.api.types.is_extension_array_dtype(dtype_b) or isinstance(dtype_b, dict) ): - pytest.xfail(reason="Extension / mixed with multiple inputs not implemented.") + request.node.add_marker( + pytest.mark.xfail( + reason="Extension / mixed with multiple inputs not implemented." + ) + ) df1 = pd.DataFrame({"A": [1, 2], "B": [3, 4]}).astype(dtype_a) @@ -80,9 +88,13 @@ def test_binary_input_aligns_columns(dtype_a, dtype_b): @pytest.mark.parametrize("dtype", dtypes) -def test_binary_input_aligns_index(dtype): +def test_binary_input_aligns_index(request, dtype): if pd.api.types.is_extension_array_dtype(dtype) or isinstance(dtype, dict): - pytest.xfail(reason="Extension / mixed with multiple inputs not implemented.") + request.node.add_marker( + pytest.mark.xfail( + reason="Extension / mixed with multiple inputs not implemented." + ) + ) df1 = pd.DataFrame({"A": [1, 2], "B": [3, 4]}, index=["a", "b"]).astype(dtype) df2 = pd.DataFrame({"A": [1, 2], "B": [3, 4]}, index=["a", "c"]).astype(dtype) result = np.heaviside(df1, df2) diff --git a/pandas/tests/generic/test_finalize.py b/pandas/tests/generic/test_finalize.py index 4974d3fff1df4..73a68e8508644 100644 --- a/pandas/tests/generic/test_finalize.py +++ b/pandas/tests/generic/test_finalize.py @@ -547,14 +547,14 @@ def test_finalize_called_eval_numexpr(): (pd.DataFrame({"A": [1]}), pd.Series([1])), ], ) -def test_binops(args, annotate, all_arithmetic_functions): +def test_binops(request, args, annotate, all_arithmetic_functions): # This generates 326 tests... Is that needed? left, right = args if annotate == "both" and isinstance(left, int) or isinstance(right, int): return if isinstance(left, pd.DataFrame) or isinstance(right, pd.DataFrame): - pytest.xfail(reason="not implemented") + request.node.add_marker(pytest.mark.xfail(reason="not implemented")) if annotate in {"left", "both"} and not isinstance(left, int): left.attrs = {"a": 1} diff --git a/pandas/tests/groupby/transform/test_transform.py b/pandas/tests/groupby/transform/test_transform.py index 72637400ff023..216d37a381c32 100644 --- a/pandas/tests/groupby/transform/test_transform.py +++ b/pandas/tests/groupby/transform/test_transform.py @@ -158,10 +158,10 @@ def test_transform_broadcast(tsframe, ts): assert_fp_equal(res.xs(idx), agged[idx]) -def test_transform_axis_1(transformation_func): +def test_transform_axis_1(request, transformation_func): # GH 36308 if transformation_func == "tshift": - pytest.xfail("tshift is deprecated") + request.node.add_marker(pytest.mark.xfail(reason="tshift is deprecated")) args = ("ffill",) if transformation_func == "fillna" else () df = DataFrame({"a": [1, 2], "b": [3, 4], "c": [5, 6]}, index=["x", "y"]) @@ -333,7 +333,7 @@ def test_dispatch_transform(tsframe): tm.assert_frame_equal(filled, expected) -def test_transform_transformation_func(transformation_func): +def test_transform_transformation_func(request, transformation_func): # GH 30918 df = DataFrame( { @@ -354,7 +354,7 @@ def test_transform_transformation_func(transformation_func): "Current behavior of groupby.tshift is inconsistent with other " "transformations. See GH34452 for more details" ) - pytest.xfail(msg) + request.node.add_marker(pytest.mark.xfail(reason=msg)) else: test_op = lambda x: x.transform(transformation_func) mock_op = lambda x: getattr(x, transformation_func)() @@ -1038,16 +1038,22 @@ def test_transform_invalid_name_raises(): Series([0, 0, 0, 1, 1, 1], index=["A", "B", "C", "D", "E", "F"]), ], ) -def test_transform_agg_by_name(reduction_func, obj): +def test_transform_agg_by_name(request, reduction_func, obj): func = reduction_func g = obj.groupby(np.repeat([0, 1], 3)) if func == "ngroup": # GH#27468 - pytest.xfail("TODO: g.transform('ngroup') doesn't work") - if func == "size": # GH#27469 - pytest.xfail("TODO: g.transform('size') doesn't work") + request.node.add_marker( + pytest.mark.xfail(reason="TODO: g.transform('ngroup') doesn't work") + ) + if func == "size" and obj.ndim == 2: # GH#27469 + request.node.add_marker( + pytest.mark.xfail(reason="TODO: g.transform('size') doesn't work") + ) if func == "corrwith" and isinstance(obj, Series): # GH#32293 - pytest.xfail("TODO: implement SeriesGroupBy.corrwith") + request.node.add_marker( + pytest.mark.xfail(reason="TODO: implement SeriesGroupBy.corrwith") + ) args = {"nth": [0], "quantile": [0.5], "corrwith": [obj]}.get(func, []) diff --git a/pandas/tests/indexes/datetimes/test_ops.py b/pandas/tests/indexes/datetimes/test_ops.py index 0352759e7381b..a24c8e252d234 100644 --- a/pandas/tests/indexes/datetimes/test_ops.py +++ b/pandas/tests/indexes/datetimes/test_ops.py @@ -123,10 +123,12 @@ def test_repeat(self, tz_naive_fixture): ("U", "microsecond"), ], ) - def test_resolution(self, tz_naive_fixture, freq, expected): + def test_resolution(self, request, tz_naive_fixture, freq, expected): tz = tz_naive_fixture if freq == "A" and not IS64 and isinstance(tz, tzlocal): - pytest.xfail(reason="OverflowError inside tzlocal past 2038") + request.node.add_marker( + pytest.mark.xfail(reason="OverflowError inside tzlocal past 2038") + ) idx = date_range(start="2013-04-01", periods=30, freq=freq, tz=tz) assert idx.resolution == expected diff --git a/pandas/tests/indexes/test_base.py b/pandas/tests/indexes/test_base.py index e5bb78604207f..1eca7f7a5d261 100644 --- a/pandas/tests/indexes/test_base.py +++ b/pandas/tests/indexes/test_base.py @@ -1596,13 +1596,15 @@ def test_isin_nan_common_object(self, nulls_fixture, nulls_fixture2): np.array([False, False]), ) - def test_isin_nan_common_float64(self, nulls_fixture): + 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: - pytest.xfail("Float64Index cannot contain pd.NA") + request.node.add_marker( + pytest.mark.xfail(reason="Float64Index cannot contain pd.NA") + ) tm.assert_numpy_array_equal( Float64Index([1.0, nulls_fixture]).isin([np.nan]), np.array([False, True]) diff --git a/pandas/tests/indexes/test_setops.py b/pandas/tests/indexes/test_setops.py index 912743e45975a..64b08c6058b81 100644 --- a/pandas/tests/indexes/test_setops.py +++ b/pandas/tests/indexes/test_setops.py @@ -38,19 +38,21 @@ def test_union_same_types(index): assert idx1.union(idx2).dtype == idx1.dtype -def test_union_different_types(index, index_fixture2): +def test_union_different_types(request, index, index_fixture2): # This test only considers combinations of indices # GH 23525 idx1, idx2 = index, index_fixture2 type_pair = tuple(sorted([type(idx1), type(idx2)], key=lambda x: str(x))) if type_pair in COMPATIBLE_INCONSISTENT_PAIRS: - pytest.xfail("This test only considers non compatible indexes.") + request.node.add_marker( + pytest.mark.xfail(reason="This test only considers non compatible indexes.") + ) if any(isinstance(idx, pd.MultiIndex) for idx in (idx1, idx2)): pytest.xfail("This test doesn't consider multiindixes.") if is_dtype_equal(idx1.dtype, idx2.dtype): - pytest.xfail("This test only considers non matching dtypes.") + pytest.skip("This test only considers non matching dtypes.") # A union with a CategoricalIndex (even as dtype('O')) and a # non-CategoricalIndex can only be made if both indices are monotonic. diff --git a/pandas/tests/indexing/test_coercion.py b/pandas/tests/indexing/test_coercion.py index 41f967ce32796..d2567ca06ebde 100644 --- a/pandas/tests/indexing/test_coercion.py +++ b/pandas/tests/indexing/test_coercion.py @@ -339,26 +339,33 @@ def test_setitem_index_float64(self, val, exp_dtype, request): exp_index = pd.Index([1.1, 2.1, 3.1, 4.1, val]) self._assert_setitem_index_conversion(obj, val, exp_index, exp_dtype) - def test_setitem_series_period(self): - pytest.xfail("Test not implemented") + def test_setitem_series_period(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_setitem_index_complex128(self): - pytest.xfail("Test not implemented") + def test_setitem_index_complex128(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_setitem_index_bool(self): - pytest.xfail("Test not implemented") + def test_setitem_index_bool(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_setitem_index_datetime64(self): - pytest.xfail("Test not implemented") + def test_setitem_index_datetime64(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_setitem_index_datetime64tz(self): - pytest.xfail("Test not implemented") + def test_setitem_index_datetime64tz(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_setitem_index_timedelta64(self): - pytest.xfail("Test not implemented") + def test_setitem_index_timedelta64(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_setitem_index_period(self): - pytest.xfail("Test not implemented") + def test_setitem_index_period(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False class TestInsertIndexCoercion(CoercionBase): @@ -429,7 +436,7 @@ def test_insert_index_float64(self, insert, coerced_val, coerced_dtype): ], ids=["datetime64", "datetime64tz"], ) - def test_insert_index_datetimes(self, fill_val, exp_dtype): + def test_insert_index_datetimes(self, request, fill_val, exp_dtype): obj = pd.DatetimeIndex( ["2011-01-01", "2011-01-02", "2011-01-03", "2011-01-04"], tz=fill_val.tz ) @@ -511,11 +518,13 @@ def test_insert_index_period(self, insert, coerced_val, coerced_dtype): # passing keywords to pd.Index pd.Index(data, freq="M") - def test_insert_index_complex128(self): - pytest.xfail("Test not implemented") + def test_insert_index_complex128(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_insert_index_bool(self): - pytest.xfail("Test not implemented") + def test_insert_index_bool(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False class TestWhereCoercion(CoercionBase): @@ -760,17 +769,21 @@ def test_where_index_datetime64tz(self): self._assert_where_conversion(obj, cond, values, exp, exp_dtype) - def test_where_index_complex128(self): - pytest.xfail("Test not implemented") + def test_where_index_complex128(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_where_index_bool(self): - pytest.xfail("Test not implemented") + def test_where_index_bool(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_where_series_timedelta64(self): - pytest.xfail("Test not implemented") + def test_where_series_timedelta64(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_where_series_period(self): - pytest.xfail("Test not implemented") + def test_where_series_period(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False @pytest.mark.parametrize( "value", [pd.Timedelta(days=9), timedelta(days=9), np.timedelta64(9, "D")] @@ -822,8 +835,9 @@ class TestFillnaSeriesCoercion(CoercionBase): method = "fillna" - def test_has_comprehensive_tests(self): - pytest.xfail("Test not implemented") + def test_has_comprehensive_tests(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False def _assert_fillna_conversion(self, original, value, expected, expected_dtype): """ test coercion triggered by fillna """ @@ -942,29 +956,37 @@ def test_fillna_datetime64tz(self, index_or_series, fill_val, fill_dtype): ) self._assert_fillna_conversion(obj, fill_val, exp, fill_dtype) - def test_fillna_series_int64(self): - pytest.xfail("Test not implemented") + def test_fillna_series_int64(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_fillna_index_int64(self): - pytest.xfail("Test not implemented") + def test_fillna_index_int64(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_fillna_series_bool(self): - pytest.xfail("Test not implemented") + def test_fillna_series_bool(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_fillna_index_bool(self): - pytest.xfail("Test not implemented") + def test_fillna_index_bool(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_fillna_series_timedelta64(self): - pytest.xfail("Test not implemented") + def test_fillna_series_timedelta64(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_fillna_series_period(self): - pytest.xfail("Test not implemented") + def test_fillna_series_period(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_fillna_index_timedelta64(self): - pytest.xfail("Test not implemented") + def test_fillna_index_timedelta64(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False - def test_fillna_index_period(self): - pytest.xfail("Test not implemented") + def test_fillna_index_period(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False class TestReplaceSeriesCoercion(CoercionBase): @@ -1120,5 +1142,6 @@ def test_replace_series_datetime_datetime(self, how, to_key, from_key): tm.assert_series_equal(result, exp) - def test_replace_series_period(self): - pytest.xfail("Test not implemented") + def test_replace_series_period(self, request): + request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) + assert False diff --git a/pandas/tests/io/excel/test_readers.py b/pandas/tests/io/excel/test_readers.py index 110b79adb5646..5b3857c9cae95 100644 --- a/pandas/tests/io/excel/test_readers.py +++ b/pandas/tests/io/excel/test_readers.py @@ -136,9 +136,13 @@ def test_usecols_int(self, read_ext, df_ref): usecols=3, ) - def test_usecols_list(self, read_ext, df_ref): + def test_usecols_list(self, request, read_ext, df_ref): if pd.read_excel.keywords["engine"] == "pyxlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb" + ) + ) df_ref = df_ref.reindex(columns=["B", "C"]) df1 = pd.read_excel( @@ -156,9 +160,13 @@ def test_usecols_list(self, read_ext, df_ref): tm.assert_frame_equal(df1, df_ref, check_names=False) tm.assert_frame_equal(df2, df_ref, check_names=False) - def test_usecols_str(self, read_ext, df_ref): + def test_usecols_str(self, request, read_ext, df_ref): if pd.read_excel.keywords["engine"] == "pyxlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb" + ) + ) df1 = df_ref.reindex(columns=["A", "B", "C"]) df2 = pd.read_excel( @@ -208,9 +216,15 @@ def test_usecols_str(self, read_ext, df_ref): @pytest.mark.parametrize( "usecols", [[0, 1, 3], [0, 3, 1], [1, 0, 3], [1, 3, 0], [3, 0, 1], [3, 1, 0]] ) - def test_usecols_diff_positional_int_columns_order(self, read_ext, usecols, df_ref): + def test_usecols_diff_positional_int_columns_order( + self, request, read_ext, usecols, df_ref + ): if pd.read_excel.keywords["engine"] == "pyxlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb" + ) + ) expected = df_ref[["A", "C"]] result = pd.read_excel( @@ -226,17 +240,25 @@ def test_usecols_diff_positional_str_columns_order(self, read_ext, usecols, df_r result = pd.read_excel("test1" + read_ext, sheet_name="Sheet1", usecols=usecols) tm.assert_frame_equal(result, expected, check_names=False) - def test_read_excel_without_slicing(self, read_ext, df_ref): + def test_read_excel_without_slicing(self, request, read_ext, df_ref): if pd.read_excel.keywords["engine"] == "pyxlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb" + ) + ) expected = df_ref result = pd.read_excel("test1" + read_ext, sheet_name="Sheet1", index_col=0) tm.assert_frame_equal(result, expected, check_names=False) - def test_usecols_excel_range_str(self, read_ext, df_ref): + def test_usecols_excel_range_str(self, request, read_ext, df_ref): if pd.read_excel.keywords["engine"] == "pyxlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb" + ) + ) expected = df_ref[["C", "D"]] result = pd.read_excel( @@ -310,17 +332,25 @@ def test_excel_stop_iterator(self, read_ext): expected = DataFrame([["aaaa", "bbbbb"]], columns=["Test", "Test1"]) tm.assert_frame_equal(parsed, expected) - def test_excel_cell_error_na(self, read_ext): + def test_excel_cell_error_na(self, request, read_ext): if pd.read_excel.keywords["engine"] == "pyxlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb" + ) + ) parsed = pd.read_excel("test3" + read_ext, sheet_name="Sheet1") expected = DataFrame([[np.nan]], columns=["Test"]) tm.assert_frame_equal(parsed, expected) - def test_excel_table(self, read_ext, df_ref): + def test_excel_table(self, request, read_ext, df_ref): if pd.read_excel.keywords["engine"] == "pyxlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb" + ) + ) df1 = pd.read_excel("test1" + read_ext, sheet_name="Sheet1", index_col=0) df2 = pd.read_excel( @@ -335,9 +365,13 @@ def test_excel_table(self, read_ext, df_ref): ) tm.assert_frame_equal(df3, df1.iloc[:-1]) - def test_reader_special_dtypes(self, read_ext): + def test_reader_special_dtypes(self, request, read_ext): if pd.read_excel.keywords["engine"] == "pyxlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb" + ) + ) expected = DataFrame.from_dict( { @@ -568,10 +602,14 @@ def test_read_excel_blank_with_header(self, read_ext): actual = pd.read_excel("blank_with_header" + read_ext, sheet_name="Sheet1") tm.assert_frame_equal(actual, expected) - def test_date_conversion_overflow(self, read_ext): + def test_date_conversion_overflow(self, request, read_ext): # GH 10001 : pandas.ExcelFile ignore parse_dates=False if pd.read_excel.keywords["engine"] == "pyxlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb" + ) + ) expected = DataFrame( [ @@ -583,24 +621,29 @@ def test_date_conversion_overflow(self, read_ext): ) if pd.read_excel.keywords["engine"] == "openpyxl": - pytest.xfail("Maybe not supported by openpyxl") + request.node.add_marker( + pytest.mark.xfail(reason="Maybe not supported by openpyxl") + ) - if pd.read_excel.keywords["engine"] is None: + if pd.read_excel.keywords["engine"] is None and read_ext in (".xlsx", ".xlsm"): # GH 35029 - pytest.xfail("Defaults to openpyxl, maybe not supported") + request.node.add_marker( + pytest.mark.xfail(reason="Defaults to openpyxl, maybe not supported") + ) result = pd.read_excel("testdateoverflow" + read_ext) tm.assert_frame_equal(result, expected) - def test_sheet_name(self, read_ext, df_ref): + def test_sheet_name(self, request, read_ext, df_ref): if pd.read_excel.keywords["engine"] == "pyxlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb" + ) + ) filename = "test1" sheet_name = "Sheet1" - if pd.read_excel.keywords["engine"] == "openpyxl": - pytest.xfail("Maybe not supported by openpyxl") - df1 = pd.read_excel( filename + read_ext, sheet_name=sheet_name, index_col=0 ) # doc @@ -730,9 +773,13 @@ def test_close_from_py_localpath(self, read_ext): # should not throw an exception because the passed file was closed f.read() - def test_reader_seconds(self, read_ext): + def test_reader_seconds(self, request, read_ext): if pd.read_excel.keywords["engine"] == "pyxlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb" + ) + ) # Test reading times with and without milliseconds. GH5945. expected = DataFrame.from_dict( @@ -759,10 +806,14 @@ def test_reader_seconds(self, read_ext): actual = pd.read_excel("times_1904" + read_ext, sheet_name="Sheet1") tm.assert_frame_equal(actual, expected) - def test_read_excel_multiindex(self, read_ext): + def test_read_excel_multiindex(self, request, read_ext): # see gh-4679 if pd.read_excel.keywords["engine"] == "pyxlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb" + ) + ) mi = MultiIndex.from_product([["foo", "bar"], ["a", "b"]]) mi_file = "testmultiindex" + read_ext @@ -849,11 +900,15 @@ def test_read_excel_multiindex(self, read_ext): ], ) def test_read_excel_multiindex_blank_after_name( - self, read_ext, sheet_name, idx_lvl2 + self, request, read_ext, sheet_name, idx_lvl2 ): # GH34673 if pd.read_excel.keywords["engine"] == "pyxlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb (GH4679") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb (GH4679" + ) + ) mi_file = "testmultiindex" + read_ext mi = MultiIndex.from_product([["foo", "bar"], ["a", "b"]], names=["c1", "c2"]) @@ -968,10 +1023,14 @@ def test_read_excel_bool_header_arg(self, read_ext): with pytest.raises(TypeError, match=msg): pd.read_excel("test1" + read_ext, header=arg) - def test_read_excel_skiprows(self, read_ext): + def test_read_excel_skiprows(self, request, read_ext): # GH 4903 if pd.read_excel.keywords["engine"] == "pyxlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb" + ) + ) actual = pd.read_excel( "testskiprows" + read_ext, sheet_name="skiprows_list", skiprows=[0, 2] @@ -1151,11 +1210,15 @@ def test_excel_passes_na_filter(self, read_ext, na_filter): expected = DataFrame(expected, columns=["Test"]) tm.assert_frame_equal(parsed, expected) - def test_excel_table_sheet_by_index(self, read_ext, df_ref): + def test_excel_table_sheet_by_index(self, request, read_ext, df_ref): # For some reason pd.read_excel has no attribute 'keywords' here. # Skipping based on read_ext instead. if read_ext == ".xlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb" + ) + ) with pd.ExcelFile("test1" + read_ext) as excel: df1 = pd.read_excel(excel, sheet_name=0, index_col=0) @@ -1178,11 +1241,15 @@ def test_excel_table_sheet_by_index(self, read_ext, df_ref): tm.assert_frame_equal(df3, df1.iloc[:-1]) - def test_sheet_name(self, read_ext, df_ref): + def test_sheet_name(self, request, read_ext, df_ref): # For some reason pd.read_excel has no attribute 'keywords' here. # Skipping based on read_ext instead. if read_ext == ".xlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb" + ) + ) filename = "test1" sheet_name = "Sheet1" @@ -1232,10 +1299,14 @@ def test_excel_read_binary(self, engine, read_ext): actual = pd.read_excel(data, engine=engine) tm.assert_frame_equal(expected, actual) - def test_excel_read_binary_via_read_excel(self, read_ext, engine): + def test_excel_read_binary_via_read_excel(self, request, read_ext, engine): # GH 38424 if read_ext == ".xlsb" and engine == "pyxlsb": - pytest.xfail("GH 38667 - should default to pyxlsb but doesn't") + request.node.add_marker( + pytest.mark.xfail( + reason="GH 38667 - should default to pyxlsb but doesn't" + ) + ) with open("test1" + read_ext, "rb") as f: result = pd.read_excel(f) expected = pd.read_excel("test1" + read_ext, engine=engine) @@ -1264,10 +1335,14 @@ def test_header_with_index_col(self, engine, filename): ) tm.assert_frame_equal(expected, result) - def test_read_datetime_multiindex(self, engine, read_ext): + def test_read_datetime_multiindex(self, request, engine, read_ext): # GH 34748 if engine == "pyxlsb": - pytest.xfail("Sheets containing datetimes not supported by pyxlsb") + request.node.add_marker( + pytest.mark.xfail( + reason="Sheets containing datetimes not supported by pyxlsb" + ) + ) f = "test_datetime_mi" + read_ext with pd.ExcelFile(f) as excel: diff --git a/pandas/tests/io/excel/test_style.py b/pandas/tests/io/excel/test_style.py index 6b1abebe0506a..ed996d32cf2fb 100644 --- a/pandas/tests/io/excel/test_style.py +++ b/pandas/tests/io/excel/test_style.py @@ -21,7 +21,7 @@ "openpyxl", ], ) -def test_styler_to_excel(engine): +def test_styler_to_excel(request, engine): def style(df): # TODO: RGB colors not supported in xlwt return DataFrame( @@ -44,8 +44,12 @@ def style(df): def assert_equal_style(cell1, cell2, engine): if engine in ["xlsxwriter", "openpyxl"]: - pytest.xfail( - reason=(f"GH25351: failing on some attribute comparisons in {engine}") + request.node.add_marker( + pytest.mark.xfail( + reason=( + f"GH25351: failing on some attribute comparisons in {engine}" + ) + ) ) # TODO: should find a better way to check equality assert cell1.alignment.__dict__ == cell2.alignment.__dict__ diff --git a/pandas/tests/io/json/test_pandas.py b/pandas/tests/io/json/test_pandas.py index 851e64a3f2478..eaf35c845ab9a 100644 --- a/pandas/tests/io/json/test_pandas.py +++ b/pandas/tests/io/json/test_pandas.py @@ -165,7 +165,7 @@ def test_roundtrip_intframe(self, orient, convert_axes, numpy, dtype, int_frame) @pytest.mark.parametrize("dtype", [None, np.float64, int, "U3"]) @pytest.mark.parametrize("convert_axes", [True, False]) @pytest.mark.parametrize("numpy", [True, False]) - def test_roundtrip_str_axes(self, orient, convert_axes, numpy, dtype): + def test_roundtrip_str_axes(self, request, orient, convert_axes, numpy, dtype): df = DataFrame( np.zeros((200, 4)), columns=[str(i) for i in range(4)], @@ -175,7 +175,9 @@ def test_roundtrip_str_axes(self, orient, convert_axes, numpy, dtype): # TODO: do we even need to support U3 dtypes? if numpy and dtype == "U3" and orient != "split": - pytest.xfail("Can't decode directly to array") + request.node.add_marker( + pytest.mark.xfail(reason="Can't decode directly to array") + ) data = df.to_json(orient=orient) result = pd.read_json( @@ -202,14 +204,20 @@ def test_roundtrip_str_axes(self, orient, convert_axes, numpy, dtype): @pytest.mark.parametrize("convert_axes", [True, False]) @pytest.mark.parametrize("numpy", [True, False]) - def test_roundtrip_categorical(self, orient, convert_axes, numpy): + def test_roundtrip_categorical(self, request, orient, convert_axes, numpy): # TODO: create a better frame to test with and improve coverage if orient in ("index", "columns"): - pytest.xfail(f"Can't have duplicate index values for orient '{orient}')") + request.node.add_marker( + pytest.mark.xfail( + reason=f"Can't have duplicate index values for orient '{orient}')" + ) + ) data = self.categorical.to_json(orient=orient) if numpy and orient in ("records", "values"): - pytest.xfail(f"Orient {orient} is broken with numpy=True") + request.node.add_marker( + pytest.mark.xfail(reason=f"Orient {orient} is broken with numpy=True") + ) result = pd.read_json( data, orient=orient, convert_axes=convert_axes, numpy=numpy @@ -264,9 +272,11 @@ def test_roundtrip_timestamp(self, orient, convert_axes, numpy, datetime_frame): @pytest.mark.parametrize("convert_axes", [True, False]) @pytest.mark.parametrize("numpy", [True, False]) - def test_roundtrip_mixed(self, orient, convert_axes, numpy): + def test_roundtrip_mixed(self, request, orient, convert_axes, numpy): if numpy and orient != "split": - pytest.xfail("Can't decode directly to array") + request.node.add_marker( + pytest.mark.xfail(reason="Can't decode directly to array") + ) index = pd.Index(["a", "b", "c", "d", "e"]) values = { diff --git a/pandas/tests/io/test_parquet.py b/pandas/tests/io/test_parquet.py index 822b412916726..c6969fd5bbb74 100644 --- a/pandas/tests/io/test_parquet.py +++ b/pandas/tests/io/test_parquet.py @@ -309,16 +309,18 @@ def test_cross_engine_pa_fp(df_cross_compat, pa, fp): tm.assert_frame_equal(result, df[["a", "d"]]) -def test_cross_engine_fp_pa(df_cross_compat, pa, fp): +def test_cross_engine_fp_pa(request, df_cross_compat, pa, fp): # cross-compat with differing reading/writing engines if ( LooseVersion(pyarrow.__version__) < "0.15" and LooseVersion(pyarrow.__version__) >= "0.13" ): - pytest.xfail( - "Reading fastparquet with pyarrow in 0.14 fails: " - "https://issues.apache.org/jira/browse/ARROW-6492" + request.node.add_marker( + pytest.mark.xfail( + "Reading fastparquet with pyarrow in 0.14 fails: " + "https://issues.apache.org/jira/browse/ARROW-6492" + ) ) df = df_cross_compat diff --git a/pandas/tests/resample/test_time_grouper.py b/pandas/tests/resample/test_time_grouper.py index c12111e20a4b1..c669cf39c9a61 100644 --- a/pandas/tests/resample/test_time_grouper.py +++ b/pandas/tests/resample/test_time_grouper.py @@ -117,10 +117,12 @@ def test_aaa_group_order(): tm.assert_frame_equal(grouped.get_group(datetime(2013, 1, 5)), df[4::5]) -def test_aggregate_normal(resample_method): +def test_aggregate_normal(request, resample_method): """Check TimeGrouper's aggregation is identical as normal groupby.""" if resample_method == "ohlc": - pytest.xfail(reason="DataError: No numeric types to aggregate") + request.node.add_marker( + pytest.mark.xfail(reason="DataError: No numeric types to aggregate") + ) data = np.random.randn(20, 4) normal_df = DataFrame(data, columns=["A", "B", "C", "D"]) diff --git a/pandas/tests/series/indexing/test_where.py b/pandas/tests/series/indexing/test_where.py index 59c68fba53e25..81dc2db2f0035 100644 --- a/pandas/tests/series/indexing/test_where.py +++ b/pandas/tests/series/indexing/test_where.py @@ -466,7 +466,7 @@ def test_where_categorical(klass): tm.assert_equal(exp, res) -def test_where_datetimelike_categorical(tz_naive_fixture): +def test_where_datetimelike_categorical(request, tz_naive_fixture): # GH#37682 tz = tz_naive_fixture @@ -492,7 +492,9 @@ def test_where_datetimelike_categorical(tz_naive_fixture): if tz is None: res = pd.DataFrame(lvals).where(mask[:, None], pd.DataFrame(rvals)) else: - with pytest.xfail(reason="frame._values loses tz"): + with request.node.add_marker( + pytest.mark.xfail(reason="frame._values loses tz") + ): res = pd.DataFrame(lvals).where(mask[:, None], pd.DataFrame(rvals)) tm.assert_frame_equal(res, pd.DataFrame(dr)) diff --git a/pandas/tests/series/test_arithmetic.py b/pandas/tests/series/test_arithmetic.py index a0e0213a6dce5..219aaddb116cd 100644 --- a/pandas/tests/series/test_arithmetic.py +++ b/pandas/tests/series/test_arithmetic.py @@ -737,12 +737,18 @@ def test_align_date_objects_with_datetimeindex(self): class TestNamePreservation: @pytest.mark.parametrize("box", [list, tuple, np.array, Index, Series, pd.array]) @pytest.mark.parametrize("flex", [True, False]) - def test_series_ops_name_retention(self, flex, box, names, all_binary_operators): + def test_series_ops_name_retention( + self, request, flex, box, names, all_binary_operators + ): # GH#33930 consistent name renteiton op = all_binary_operators - if op is ops.rfloordiv and box in [list, tuple]: - pytest.xfail("op fails because of inconsistent ndarray-wrapping GH#28759") + if op is ops.rfloordiv and box in [list, tuple] and not flex: + request.node.add_marker( + pytest.mark.xfail( + reason="op fails because of inconsistent ndarray-wrapping GH#28759" + ) + ) left = Series(range(10), name=names[0]) right = Series(range(10), name=names[1]) diff --git a/pandas/tests/tseries/offsets/test_offsets.py b/pandas/tests/tseries/offsets/test_offsets.py index 325a5311829dc..a4c1c9c0b68fc 100644 --- a/pandas/tests/tseries/offsets/test_offsets.py +++ b/pandas/tests/tseries/offsets/test_offsets.py @@ -125,12 +125,14 @@ def _get_offset(self, klass, value=1, normalize=False): klass = klass(value, normalize=normalize) return klass - def test_apply_out_of_range(self, tz_naive_fixture): + def test_apply_out_of_range(self, request, tz_naive_fixture): tz = tz_naive_fixture if self._offset is None: return if isinstance(tz, tzlocal) and not IS64: - pytest.xfail(reason="OverflowError inside tzlocal past 2038") + request.node.add_marker( + pytest.mark.xfail(reason="OverflowError inside tzlocal past 2038") + ) # try to create an out-of-bounds result timestamp; if we can't create # the offset skip From b9ba1db03efb6b1e5be8e6afe1255f1d12bad1d0 Mon Sep 17 00:00:00 2001 From: Richard Shadrach Date: Sat, 2 Jan 2021 10:31:49 -0500 Subject: [PATCH 2/5] A few reverts --- pandas/tests/indexing/test_coercion.py | 2 +- pandas/tests/series/test_arithmetic.py | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/pandas/tests/indexing/test_coercion.py b/pandas/tests/indexing/test_coercion.py index d2567ca06ebde..d2238de8830ca 100644 --- a/pandas/tests/indexing/test_coercion.py +++ b/pandas/tests/indexing/test_coercion.py @@ -436,7 +436,7 @@ def test_insert_index_float64(self, insert, coerced_val, coerced_dtype): ], ids=["datetime64", "datetime64tz"], ) - def test_insert_index_datetimes(self, request, fill_val, exp_dtype): + def test_insert_index_datetimes(self, fill_val, exp_dtype): obj = pd.DatetimeIndex( ["2011-01-01", "2011-01-02", "2011-01-03", "2011-01-04"], tz=fill_val.tz ) diff --git a/pandas/tests/series/test_arithmetic.py b/pandas/tests/series/test_arithmetic.py index 219aaddb116cd..a0e0213a6dce5 100644 --- a/pandas/tests/series/test_arithmetic.py +++ b/pandas/tests/series/test_arithmetic.py @@ -737,18 +737,12 @@ def test_align_date_objects_with_datetimeindex(self): class TestNamePreservation: @pytest.mark.parametrize("box", [list, tuple, np.array, Index, Series, pd.array]) @pytest.mark.parametrize("flex", [True, False]) - def test_series_ops_name_retention( - self, request, flex, box, names, all_binary_operators - ): + def test_series_ops_name_retention(self, flex, box, names, all_binary_operators): # GH#33930 consistent name renteiton op = all_binary_operators - if op is ops.rfloordiv and box in [list, tuple] and not flex: - request.node.add_marker( - pytest.mark.xfail( - reason="op fails because of inconsistent ndarray-wrapping GH#28759" - ) - ) + if op is ops.rfloordiv and box in [list, tuple]: + pytest.xfail("op fails because of inconsistent ndarray-wrapping GH#28759") left = Series(range(10), name=names[0]) right = Series(range(10), name=names[1]) From 56838166deda7ff850b10305e03f297d32cc1c7c Mon Sep 17 00:00:00 2001 From: Richard Shadrach Date: Sat, 2 Jan 2021 10:38:54 -0500 Subject: [PATCH 3/5] One more revert --- pandas/tests/series/indexing/test_where.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pandas/tests/series/indexing/test_where.py b/pandas/tests/series/indexing/test_where.py index 81dc2db2f0035..59c68fba53e25 100644 --- a/pandas/tests/series/indexing/test_where.py +++ b/pandas/tests/series/indexing/test_where.py @@ -466,7 +466,7 @@ def test_where_categorical(klass): tm.assert_equal(exp, res) -def test_where_datetimelike_categorical(request, tz_naive_fixture): +def test_where_datetimelike_categorical(tz_naive_fixture): # GH#37682 tz = tz_naive_fixture @@ -492,9 +492,7 @@ def test_where_datetimelike_categorical(request, tz_naive_fixture): if tz is None: res = pd.DataFrame(lvals).where(mask[:, None], pd.DataFrame(rvals)) else: - with request.node.add_marker( - pytest.mark.xfail(reason="frame._values loses tz") - ): + with pytest.xfail(reason="frame._values loses tz"): res = pd.DataFrame(lvals).where(mask[:, None], pd.DataFrame(rvals)) tm.assert_frame_equal(res, pd.DataFrame(dr)) From 7fd48be45f8ada652457acb9dbf2d42c3fe06ce7 Mon Sep 17 00:00:00 2001 From: Richard Shadrach Date: Sat, 2 Jan 2021 11:49:15 -0500 Subject: [PATCH 4/5] Added call to super, used decorator, reverted test_apply_out_of_range --- pandas/tests/extension/test_categorical.py | 6 +- pandas/tests/indexing/test_coercion.py | 138 +++++++++---------- pandas/tests/tseries/offsets/test_offsets.py | 6 +- 3 files changed, 73 insertions(+), 77 deletions(-) diff --git a/pandas/tests/extension/test_categorical.py b/pandas/tests/extension/test_categorical.py index 69729940376f0..6560697ab8bde 100644 --- a/pandas/tests/extension/test_categorical.py +++ b/pandas/tests/extension/test_categorical.py @@ -117,11 +117,9 @@ class TestConstructors(base.BaseConstructorsTests): class TestReshaping(base.BaseReshapingTests): + @pytest.mark.xfail(reason="Deliberately upcast to object?") def test_concat_with_reindex(self, request, data): - request.node.add_marker( - pytest.mark.xfail(reason="Deliberately upcast to object?") - ) - assert False + super().test_concat_with_reindex(data) class TestGetitem(base.BaseGetitemTests): diff --git a/pandas/tests/indexing/test_coercion.py b/pandas/tests/indexing/test_coercion.py index d2238de8830ca..8735e2a09920d 100644 --- a/pandas/tests/indexing/test_coercion.py +++ b/pandas/tests/indexing/test_coercion.py @@ -339,33 +339,33 @@ def test_setitem_index_float64(self, val, exp_dtype, request): exp_index = pd.Index([1.1, 2.1, 3.1, 4.1, val]) self._assert_setitem_index_conversion(obj, val, exp_index, exp_dtype) - def test_setitem_series_period(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_setitem_series_period(self): + raise NotImplementedError - def test_setitem_index_complex128(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_setitem_index_complex128(self): + raise NotImplementedError - def test_setitem_index_bool(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_setitem_index_bool(self): + raise NotImplementedError - def test_setitem_index_datetime64(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_setitem_index_datetime64(self): + raise NotImplementedError - def test_setitem_index_datetime64tz(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_setitem_index_datetime64tz(self): + raise NotImplementedError - def test_setitem_index_timedelta64(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_setitem_index_timedelta64(self): + raise NotImplementedError - def test_setitem_index_period(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_setitem_index_period(self): + raise NotImplementedError class TestInsertIndexCoercion(CoercionBase): @@ -518,13 +518,13 @@ def test_insert_index_period(self, insert, coerced_val, coerced_dtype): # passing keywords to pd.Index pd.Index(data, freq="M") - def test_insert_index_complex128(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_insert_index_complex128(self): + raise NotImplementedError - def test_insert_index_bool(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_insert_index_bool(self): + raise NotImplementedError class TestWhereCoercion(CoercionBase): @@ -769,21 +769,21 @@ def test_where_index_datetime64tz(self): self._assert_where_conversion(obj, cond, values, exp, exp_dtype) - def test_where_index_complex128(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_where_index_complex128(self): + raise NotImplementedError - def test_where_index_bool(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_where_index_bool(self): + raise NotImplementedError - def test_where_series_timedelta64(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_where_series_timedelta64(self): + raise NotImplementedError - def test_where_series_period(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_where_series_period(self): + raise NotImplementedError @pytest.mark.parametrize( "value", [pd.Timedelta(days=9), timedelta(days=9), np.timedelta64(9, "D")] @@ -835,9 +835,9 @@ class TestFillnaSeriesCoercion(CoercionBase): method = "fillna" - def test_has_comprehensive_tests(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_has_comprehensive_tests(self): + raise NotImplementedError def _assert_fillna_conversion(self, original, value, expected, expected_dtype): """ test coercion triggered by fillna """ @@ -956,37 +956,37 @@ def test_fillna_datetime64tz(self, index_or_series, fill_val, fill_dtype): ) self._assert_fillna_conversion(obj, fill_val, exp, fill_dtype) - def test_fillna_series_int64(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_fillna_series_int64(self): + raise NotImplementedError - def test_fillna_index_int64(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_fillna_index_int64(self): + raise NotImplementedError - def test_fillna_series_bool(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_fillna_series_bool(self): + raise NotImplementedError - def test_fillna_index_bool(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_fillna_index_bool(self): + raise NotImplementedError - def test_fillna_series_timedelta64(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_fillna_series_timedelta64(self): + raise NotImplementedError - def test_fillna_series_period(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_fillna_series_period(self): + raise NotImplementedError - def test_fillna_index_timedelta64(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_fillna_index_timedelta64(self): + raise NotImplementedError - def test_fillna_index_period(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_fillna_index_period(self): + raise NotImplementedError class TestReplaceSeriesCoercion(CoercionBase): @@ -1142,6 +1142,6 @@ def test_replace_series_datetime_datetime(self, how, to_key, from_key): tm.assert_series_equal(result, exp) - def test_replace_series_period(self, request): - request.node.add_marker(pytest.mark.xfail(reason="Test not implemented")) - assert False + @pytest.mark.xfail(reason="Test not implemented") + def test_replace_series_period(self): + raise NotImplementedError diff --git a/pandas/tests/tseries/offsets/test_offsets.py b/pandas/tests/tseries/offsets/test_offsets.py index a4c1c9c0b68fc..325a5311829dc 100644 --- a/pandas/tests/tseries/offsets/test_offsets.py +++ b/pandas/tests/tseries/offsets/test_offsets.py @@ -125,14 +125,12 @@ def _get_offset(self, klass, value=1, normalize=False): klass = klass(value, normalize=normalize) return klass - def test_apply_out_of_range(self, request, tz_naive_fixture): + def test_apply_out_of_range(self, tz_naive_fixture): tz = tz_naive_fixture if self._offset is None: return if isinstance(tz, tzlocal) and not IS64: - request.node.add_marker( - pytest.mark.xfail(reason="OverflowError inside tzlocal past 2038") - ) + pytest.xfail(reason="OverflowError inside tzlocal past 2038") # try to create an out-of-bounds result timestamp; if we can't create # the offset skip From 58dc0794cf41dfb83fcb214c9534b5d274d47896 Mon Sep 17 00:00:00 2001 From: Richard Shadrach Date: Sat, 2 Jan 2021 11:55:13 -0500 Subject: [PATCH 5/5] Removed request --- pandas/tests/extension/test_categorical.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/extension/test_categorical.py b/pandas/tests/extension/test_categorical.py index 6560697ab8bde..e38de67071f15 100644 --- a/pandas/tests/extension/test_categorical.py +++ b/pandas/tests/extension/test_categorical.py @@ -118,7 +118,7 @@ class TestConstructors(base.BaseConstructorsTests): class TestReshaping(base.BaseReshapingTests): @pytest.mark.xfail(reason="Deliberately upcast to object?") - def test_concat_with_reindex(self, request, data): + def test_concat_with_reindex(self, data): super().test_concat_with_reindex(data)