Skip to content

Commit 1f6bc37

Browse files
meeseeksmachinejreback
authored andcommitted
Backport PR #27715: TST: troubleshoot inconsistent xfails (#27752)
1 parent 4792afd commit 1f6bc37

File tree

15 files changed

+31
-44
lines changed

15 files changed

+31
-44
lines changed

pandas/compat/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import struct
1212
import sys
1313

14+
PY35 = sys.version_info[:2] == (3, 5)
1415
PY36 = sys.version_info >= (3, 6)
1516
PY37 = sys.version_info >= (3, 7)
1617
PYPY = platform.python_implementation() == "PyPy"

pandas/tests/arithmetic/test_datetime64.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,7 @@ def test_comparison_tzawareness_compat_scalars(self, op, box_with_array):
705705
# Raising in __eq__ will fallback to NumPy, which warns, fails,
706706
# then re-raises the original exception. So we just need to ignore.
707707
@pytest.mark.filterwarnings("ignore:elementwise comp:DeprecationWarning")
708+
@pytest.mark.filterwarnings("ignore:Converting timezone-aware:FutureWarning")
708709
def test_scalar_comparison_tzawareness(
709710
self, op, other, tz_aware_fixture, box_with_array
710711
):

pandas/tests/computation/test_eval.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,9 +1789,10 @@ def test_result_types(self):
17891789
self.check_result_type(np.float32, np.float32)
17901790
self.check_result_type(np.float64, np.float64)
17911791

1792-
def test_result_types2(self):
1792+
@td.skip_if_windows
1793+
def test_result_complex128(self):
17931794
# xref https://github.com/pandas-dev/pandas/issues/12293
1794-
pytest.skip("unreliable tests on complex128")
1795+
# this fails on Windows, apparently a floating point precision issue
17951796

17961797
# Did not test complex64 because DataFrame is converting it to
17971798
# complex128. Due to https://github.com/pandas-dev/pandas/issues/10952

pandas/tests/extension/test_datetime.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,6 @@ def test_divmod_series_array(self):
142142
# skipping because it is not implemented
143143
pass
144144

145-
@pytest.mark.xfail(reason="different implementation", strict=False)
146-
def test_direct_arith_with_series_returns_not_implemented(self, data):
147-
# Right now, we have trouble with this. Returning NotImplemented
148-
# fails other tests like
149-
# tests/arithmetic/test_datetime64::TestTimestampSeriesArithmetic::
150-
# test_dt64_seris_add_intlike
151-
return super(
152-
TestArithmeticOps, self
153-
).test_direct_arith_with_series_returns_not_implemented(data)
154-
155145

156146
class TestCasting(BaseDatetimeTests, base.BaseCastingTests):
157147
pass
@@ -163,12 +153,6 @@ def _compare_other(self, s, data, op_name, other):
163153
# with (some) integers, depending on the value.
164154
pass
165155

166-
@pytest.mark.xfail(reason="different implementation", strict=False)
167-
def test_direct_arith_with_series_returns_not_implemented(self, data):
168-
return super(
169-
TestComparisonOps, self
170-
).test_direct_arith_with_series_returns_not_implemented(data)
171-
172156

173157
class TestMissing(BaseDatetimeTests, base.BaseMissingTests):
174158
pass

pandas/tests/frame/test_analytics.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,10 +1819,17 @@ def test_any_all_bool_only(self):
18191819
(np.any, {"A": pd.Series([0, 1], dtype="category")}, True),
18201820
(np.all, {"A": pd.Series([1, 2], dtype="category")}, True),
18211821
(np.any, {"A": pd.Series([1, 2], dtype="category")}, True),
1822-
# # Mix
1823-
# GH 21484
1824-
# (np.all, {'A': pd.Series([10, 20], dtype='M8[ns]'),
1825-
# 'B': pd.Series([10, 20], dtype='m8[ns]')}, True),
1822+
# Mix GH#21484
1823+
pytest.param(
1824+
np.all,
1825+
{
1826+
"A": pd.Series([10, 20], dtype="M8[ns]"),
1827+
"B": pd.Series([10, 20], dtype="m8[ns]"),
1828+
},
1829+
True,
1830+
# In 1.13.3 and 1.14 np.all(df) returns a Timedelta here
1831+
marks=[td.skip_if_np_lt("1.15")],
1832+
),
18261833
],
18271834
)
18281835
def test_any_all_np_func(self, func, data, expected):

pandas/tests/groupby/test_categorical.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import numpy as np
55
import pytest
66

7-
from pandas.compat import PY37
8-
97
import pandas as pd
108
from pandas import (
119
Categorical,
@@ -209,7 +207,7 @@ def test_level_get_group(observed):
209207
assert_frame_equal(result, expected)
210208

211209

212-
@pytest.mark.xfail(PY37, reason="flaky on 3.7, xref gh-21636", strict=False)
210+
# GH#21636 previously flaky on py37
213211
@pytest.mark.parametrize("ordered", [True, False])
214212
def test_apply(ordered):
215213
# GH 10138

pandas/tests/indexes/datetimes/test_construction.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,14 +759,16 @@ def test_constructor_with_int_tz(self, klass, box, tz, dtype):
759759
assert result == expected
760760

761761
# This is the desired future behavior
762+
# Note: this xfail is not strict because the test passes with
763+
# None or any of the UTC variants for tz_naive_fixture
762764
@pytest.mark.xfail(reason="Future behavior", strict=False)
763765
@pytest.mark.filterwarnings("ignore:\\n Passing:FutureWarning")
764766
def test_construction_int_rountrip(self, tz_naive_fixture):
765767
# GH 12619
766768
# TODO(GH-24559): Remove xfail
767769
tz = tz_naive_fixture
768770
result = 1293858000000000000
769-
expected = DatetimeIndex([1293858000000000000], tz=tz).asi8[0]
771+
expected = DatetimeIndex([result], tz=tz).asi8[0]
770772
assert result == expected
771773

772774
def test_construction_from_replaced_timestamps_with_dst(self):

pandas/tests/indexes/datetimes/test_tools.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,10 +741,7 @@ def test_to_datetime_tz_psycopg2(self, cache):
741741
)
742742
tm.assert_index_equal(result, expected)
743743

744-
@pytest.mark.parametrize(
745-
"cache",
746-
[pytest.param(True, marks=pytest.mark.skipif(True, reason="GH 18111")), False],
747-
)
744+
@pytest.mark.parametrize("cache", [True, False])
748745
def test_datetime_bool(self, cache):
749746
# GH13176
750747
with pytest.raises(TypeError):

pandas/tests/io/formats/test_to_csv.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ def test_to_csv_string_array_ascii(self):
340340
with open(path, "r") as f:
341341
assert f.read() == expected_ascii
342342

343-
@pytest.mark.xfail(strict=False)
344343
def test_to_csv_string_array_utf8(self):
345344
# GH 10813
346345
str_array = [{"names": ["foo", "bar"]}, {"names": ["baz", "qux"]}]

pandas/tests/io/test_parquet.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
except ImportError:
3434
_HAVE_FASTPARQUET = False
3535

36+
pytestmark = pytest.mark.filterwarnings(
37+
"ignore:RangeIndex.* is deprecated:DeprecationWarning"
38+
)
39+
3640

3741
# setup engines & skips
3842
@pytest.fixture(
@@ -408,8 +412,6 @@ def test_basic(self, pa, df_full):
408412

409413
check_round_trip(df, pa)
410414

411-
# TODO: This doesn't fail on all systems; track down which
412-
@pytest.mark.xfail(reason="pyarrow fails on this (ARROW-1883)", strict=False)
413415
def test_basic_subset_columns(self, pa, df_full):
414416
# GH18628
415417

0 commit comments

Comments
 (0)