Skip to content

TST: clean up to change setup.cfg to xfail_strict = True (GH23057) #23721

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 8 commits into from
Dec 3, 2018
4 changes: 2 additions & 2 deletions pandas/tests/arithmetic/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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):
"""
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/arithmetic/test_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/arithmetic/test_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand All @@ -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__)
Expand Down
3 changes: 1 addition & 2 deletions pandas/tests/arrays/categorical/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/arrays/sparse/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))),
Expand Down
3 changes: 1 addition & 2 deletions pandas/tests/extension/base/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions pandas/tests/extension/base/setitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/extension/json/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 10 additions & 11 deletions pandas/tests/extension/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -117,20 +117,19 @@ 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)

@skip_take
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)

Expand All @@ -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)

Expand All @@ -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)

Expand All @@ -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)

Expand Down
3 changes: 1 addition & 2 deletions pandas/tests/frame/test_combine_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions pandas/tests/frame/test_duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])),
Expand Down
3 changes: 1 addition & 2 deletions pandas/tests/groupby/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/groupby/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/indexes/interval/test_astype.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/multi/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 2 additions & 4 deletions pandas/tests/indexes/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions pandas/tests/indexing/test_coercion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]'])
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/formats/test_to_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']}]
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/formats/test_to_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']]
Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/io/json/test_json_table_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]},
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 3 additions & 1 deletion pandas/tests/io/parser/test_usecols.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions pandas/tests/io/test_excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
])
Expand Down
7 changes: 3 additions & 4 deletions pandas/tests/io/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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)})
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/plotting/test_datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/plotting/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/plotting/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading