Skip to content

Commit ae74c2b

Browse files
WillAydjreback
authored andcommitted
Converted windows / 32bit skips into decorators (pandas-dev#18693)
1 parent 9a99df4 commit ae74c2b

File tree

13 files changed

+64
-96
lines changed

13 files changed

+64
-96
lines changed

pandas/tests/computation/test_eval.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import pandas.core.computation.expr as expr
3030
import pandas.util.testing as tm
31+
import pandas.util._test_decorators as td
3132
from pandas.util.testing import (assert_frame_equal, randbool,
3233
assert_numpy_array_equal, assert_series_equal,
3334
assert_produces_warning)
@@ -175,9 +176,8 @@ def test_floor_division(self):
175176
for lhs, rhs in product(self.lhses, self.rhses):
176177
self.check_floor_division(lhs, '//', rhs)
177178

179+
@td.skip_if_windows
178180
def test_pow(self):
179-
tm._skip_if_windows()
180-
181181
# odd failure on win32 platform, so skip
182182
for lhs, rhs in product(self.lhses, self.rhses):
183183
self.check_pow(lhs, '**', rhs)

pandas/tests/indexes/datetimes/test_date_range.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import pandas as pd
1313
import pandas.util.testing as tm
14+
import pandas.util._test_decorators as td
1415
from pandas import compat
1516
from pandas import date_range, bdate_range, offsets, DatetimeIndex, Timestamp
1617
from pandas.tseries.offsets import (generate_range, CDay, BDay, DateOffset,
@@ -49,8 +50,8 @@ def test_date_range_timestamp_equiv_explicit_pytz(self):
4950
ts = Timestamp('20090415', tz=pytz.timezone('US/Eastern'), freq='D')
5051
assert ts == stamp
5152

53+
@td.skip_if_windows_python_3
5254
def test_date_range_timestamp_equiv_explicit_dateutil(self):
53-
tm._skip_if_windows_python_3()
5455
from pandas._libs.tslibs.timezones import dateutil_gettz as gettz
5556

5657
rng = date_range('20090415', '20090519', tz=gettz('US/Eastern'))

pandas/tests/indexes/datetimes/test_setops.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import pandas as pd
77
import pandas.util.testing as tm
8+
import pandas.util._test_decorators as td
89
from pandas import (DatetimeIndex, date_range, Series, bdate_range, DataFrame,
910
Int64Index, Index, to_datetime)
1011
from pandas.tseries.offsets import Minute, BMonthEnd, MonthEnd
@@ -358,9 +359,8 @@ def test_month_range_union_tz_pytz(self):
358359

359360
early_dr.union(late_dr)
360361

362+
@td.skip_if_windows_python_3
361363
def test_month_range_union_tz_dateutil(self):
362-
tm._skip_if_windows_python_3()
363-
364364
from pandas._libs.tslibs.timezones import dateutil_gettz
365365
tz = dateutil_gettz('US/Eastern')
366366

pandas/tests/indexes/period/test_period.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
import numpy as np
44

55
import pandas as pd
6+
import pandas.util._test_decorators as td
67
from pandas.util import testing as tm
78
from pandas import (PeriodIndex, period_range, notna, DatetimeIndex, NaT,
89
Index, Period, Int64Index, Series, DataFrame, date_range,
9-
offsets, compat)
10+
offsets)
1011

1112
from ..datetimelike import DatetimeLike
1213

@@ -544,9 +545,8 @@ def test_shift_nat(self):
544545
tm.assert_index_equal(result, expected)
545546
assert result.name == expected.name
546547

548+
@td.skip_if_32bit
547549
def test_ndarray_compat_properties(self):
548-
if compat.is_platform_32bit():
549-
pytest.skip("skipping on 32bit")
550550
super(TestPeriodIndex, self).test_ndarray_compat_properties()
551551

552552
def test_shift_ndarray(self):

pandas/tests/io/parser/c_parser_only.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import pandas as pd
1818
import pandas.util.testing as tm
19+
import pandas.util._test_decorators as td
1920
from pandas import DataFrame
2021
from pandas import compat
2122
from pandas.compat import StringIO, range, lrange
@@ -129,9 +130,8 @@ def test_unsupported_dtype(self):
129130
dtype={'A': 'U8'},
130131
index_col=0)
131132

133+
@td.skip_if_32bit
132134
def test_precise_conversion(self):
133-
# see gh-8002
134-
tm._skip_if_32bit()
135135
from decimal import Decimal
136136

137137
normal_errors = []

pandas/tests/io/test_pytables.py

+24-36
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717
isna, compat, concat, Timestamp)
1818

1919
import pandas.util.testing as tm
20+
import pandas.util._test_decorators as td
2021
from pandas.util.testing import (assert_panel4d_equal,
2122
assert_panel_equal,
2223
assert_frame_equal,
2324
assert_series_equal,
2425
set_timezone)
2526

2627
from pandas.compat import (is_platform_windows, is_platform_little_endian,
27-
PY3, PY35, PY36, BytesIO, text_type,
28+
PY35, PY36, BytesIO, text_type,
2829
range, lrange, u)
2930
from pandas.io.formats.printing import pprint_thing
3031
from pandas.core.dtypes.common import is_categorical_dtype
@@ -40,10 +41,6 @@
4041
LooseVersion('2.2') else 'zlib')
4142

4243

43-
# testing on windows/py3 seems to fault
44-
# for using compression
45-
skip_compression = PY3 and is_platform_windows()
46-
4744
# contextmanager to ensure the file cleanup
4845

4946

@@ -719,12 +716,10 @@ def test_put_compression(self):
719716
pytest.raises(ValueError, store.put, 'b', df,
720717
format='fixed', complib='zlib')
721718

719+
@td.skip_if_windows_python_3
722720
def test_put_compression_blosc(self):
723721
tm.skip_if_no_package('tables', min_version='2.2',
724722
app='blosc support')
725-
if skip_compression:
726-
pytest.skip("skipping on windows/PY3")
727-
728723
df = tm.makeTimeDataFrame()
729724

730725
with ensure_clean_store(self.path) as store:
@@ -2892,29 +2887,25 @@ def test_timeseries_preepoch(self):
28922887
except OverflowError:
28932888
pytest.skip('known failer on some windows platforms')
28942889

2895-
def test_frame(self):
2890+
@pytest.mark.parametrize("compression", [
2891+
False, pytest.param(True, marks=td.skip_if_windows_python_3)
2892+
])
2893+
def test_frame(self, compression):
28962894

28972895
df = tm.makeDataFrame()
28982896

28992897
# put in some random NAs
29002898
df.values[0, 0] = np.nan
29012899
df.values[5, 3] = np.nan
29022900

2903-
self._check_roundtrip_table(df, tm.assert_frame_equal)
2904-
self._check_roundtrip(df, tm.assert_frame_equal)
2905-
2906-
if not skip_compression:
2907-
self._check_roundtrip_table(df, tm.assert_frame_equal,
2908-
compression=True)
2909-
self._check_roundtrip(df, tm.assert_frame_equal,
2910-
compression=True)
2901+
self._check_roundtrip_table(df, tm.assert_frame_equal,
2902+
compression=compression)
2903+
self._check_roundtrip(df, tm.assert_frame_equal,
2904+
compression=compression)
29112905

29122906
tdf = tm.makeTimeDataFrame()
2913-
self._check_roundtrip(tdf, tm.assert_frame_equal)
2914-
2915-
if not skip_compression:
2916-
self._check_roundtrip(tdf, tm.assert_frame_equal,
2917-
compression=True)
2907+
self._check_roundtrip(tdf, tm.assert_frame_equal,
2908+
compression=compression)
29182909

29192910
with ensure_clean_store(self.path) as store:
29202911
# not consolidated
@@ -3021,7 +3012,10 @@ def test_store_series_name(self):
30213012
recons = store['series']
30223013
tm.assert_series_equal(recons, series)
30233014

3024-
def test_store_mixed(self):
3015+
@pytest.mark.parametrize("compression", [
3016+
False, pytest.param(True, marks=td.skip_if_windows_python_3)
3017+
])
3018+
def test_store_mixed(self, compression):
30253019

30263020
def _make_one():
30273021
df = tm.makeDataFrame()
@@ -3046,19 +3040,12 @@ def _make_one():
30463040
tm.assert_frame_equal(store['obj'], df2)
30473041

30483042
# check that can store Series of all of these types
3049-
self._check_roundtrip(df1['obj1'], tm.assert_series_equal)
3050-
self._check_roundtrip(df1['bool1'], tm.assert_series_equal)
3051-
self._check_roundtrip(df1['int1'], tm.assert_series_equal)
3052-
3053-
if not skip_compression:
3054-
self._check_roundtrip(df1['obj1'], tm.assert_series_equal,
3055-
compression=True)
3056-
self._check_roundtrip(df1['bool1'], tm.assert_series_equal,
3057-
compression=True)
3058-
self._check_roundtrip(df1['int1'], tm.assert_series_equal,
3059-
compression=True)
3060-
self._check_roundtrip(df1, tm.assert_frame_equal,
3061-
compression=True)
3043+
self._check_roundtrip(df1['obj1'], tm.assert_series_equal,
3044+
compression=compression)
3045+
self._check_roundtrip(df1['bool1'], tm.assert_series_equal,
3046+
compression=compression)
3047+
self._check_roundtrip(df1['int1'], tm.assert_series_equal,
3048+
compression=compression)
30623049

30633050
def test_wide(self):
30643051

@@ -5639,6 +5626,7 @@ def test_fixed_offset_tz(self):
56395626
tm.assert_index_equal(recons.index, rng)
56405627
assert rng.tz == recons.index.tz
56415628

5629+
@td.skip_if_windows
56425630
def test_store_timezone(self):
56435631
# GH2852
56445632
# issue storing datetime.date with a timezone as it resets when read

pandas/tests/scalar/test_timestamp.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from pytz.exceptions import AmbiguousTimeError, NonExistentTimeError
1616

1717
import pandas.util.testing as tm
18+
import pandas.util._test_decorators as td
1819
from pandas.tseries import offsets, frequencies
1920
from pandas._libs.tslibs.timezones import get_timezone, dateutil_gettz as gettz
2021
from pandas._libs.tslibs import conversion, period
@@ -943,6 +944,7 @@ def test_is_leap_year(self, tz):
943944
dt = Timestamp('2100-01-01 00:00:00', tz=tz)
944945
assert not dt.is_leap_year
945946

947+
@td.skip_if_windows
946948
def test_timestamp(self):
947949
# GH#17329
948950
# tz-naive --> treat it as if it were UTC for purposes of timestamp()
@@ -1366,9 +1368,8 @@ def test_timestamp_to_datetime_explicit_pytz(self):
13661368
assert stamp == dtval
13671369
assert stamp.tzinfo == dtval.tzinfo
13681370

1371+
@td.skip_if_windows_python_3
13691372
def test_timestamp_to_datetime_explicit_dateutil(self):
1370-
tm._skip_if_windows_python_3()
1371-
13721373
stamp = Timestamp('20090415', tz=gettz('US/Eastern'), freq='D')
13731374
dtval = stamp.to_pydatetime()
13741375
assert stamp == dtval

pandas/tests/sparse/test_libsparse.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
import numpy as np
55
import operator
66
import pandas.util.testing as tm
7-
8-
from pandas import compat
7+
import pandas.util._test_decorators as td
98

109
from pandas.core.sparse.array import IntIndex, BlockIndex, _make_index
1110
import pandas._libs.sparse as splib
@@ -190,6 +189,7 @@ def test_intindex_make_union(self):
190189

191190
class TestSparseIndexIntersect(object):
192191

192+
@td.skip_if_windows
193193
def test_intersect(self):
194194
def _check_correct(a, b, expected):
195195
result = a.intersect(b)
@@ -212,8 +212,6 @@ def _check_case(xloc, xlen, yloc, ylen, eloc, elen):
212212
_check_length_exc(xindex.to_int_index(),
213213
longer_index.to_int_index())
214214

215-
if compat.is_platform_windows():
216-
pytest.skip("segfaults on win-64 when all tests are run")
217215
check_cases(_check_case)
218216

219217
def test_intersect_empty(self):

pandas/tests/tseries/test_timezones.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from datetime import datetime, timedelta, tzinfo, date
1313

1414
import pandas.util.testing as tm
15+
import pandas.util._test_decorators as td
1516
import pandas.tseries.offsets as offsets
1617
from pandas.compat import lrange, zip, PY3
1718
from pandas.core.indexes.datetimes import bdate_range, date_range
@@ -958,10 +959,8 @@ def cmptz(self, tz1, tz2):
958959
def localize(self, tz, x):
959960
return x.replace(tzinfo=tz)
960961

962+
@td.skip_if_windows
961963
def test_utc_with_system_utc(self):
962-
# Skipped on win32 due to dateutil bug
963-
tm._skip_if_windows()
964-
965964
from pandas._libs.tslibs.timezones import maybe_get_tz
966965

967966
# from system utc to real utc
@@ -1270,6 +1269,7 @@ def test_ambiguous_compat(self):
12701269
assert (result_pytz.to_pydatetime().tzname() ==
12711270
result_dateutil.to_pydatetime().tzname())
12721271

1272+
@td.skip_if_windows
12731273
def test_replace_tzinfo(self):
12741274
# GH 15683
12751275
dt = datetime(2016, 3, 27, 1)
@@ -1663,6 +1663,7 @@ def test_normalize_tz(self):
16631663
assert result.is_normalized
16641664
assert not rng.is_normalized
16651665

1666+
@td.skip_if_windows
16661667
def test_normalize_tz_local(self):
16671668
# see gh-13459
16681669
timezones = ['US/Pacific', 'US/Eastern', 'UTC', 'Asia/Kolkata',

pandas/tests/util/test_testing.py

+3-9
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
import sys
66
from pandas import Series, DataFrame
77
import pandas.util.testing as tm
8+
import pandas.util._test_decorators as td
89
from pandas.util.testing import (assert_almost_equal, raise_with_traceback,
910
assert_index_equal, assert_series_equal,
1011
assert_frame_equal, assert_numpy_array_equal,
1112
RNGContext)
12-
from pandas.compat import is_platform_windows
1313

1414

1515
class TestAssertAlmostEqual(object):
@@ -159,12 +159,9 @@ def test_raise_with_traceback(self):
159159

160160
class TestAssertNumpyArrayEqual(object):
161161

162+
@td.skip_if_windows
162163
def test_numpy_array_equal_message(self):
163164

164-
if is_platform_windows():
165-
pytest.skip("windows has incomparable line-endings "
166-
"and uses L on the shape")
167-
168165
expected = """numpy array are different
169166
170167
numpy array shapes are different
@@ -287,12 +284,9 @@ def test_numpy_array_equal_message(self):
287284
assert_almost_equal(np.array([1, 2]), np.array([3, 4, 5]),
288285
obj='Index')
289286

287+
@td.skip_if_windows
290288
def test_numpy_array_equal_object_message(self):
291289

292-
if is_platform_windows():
293-
pytest.skip("windows has incomparable line-endings "
294-
"and uses L on the shape")
295-
296290
a = np.array([pd.Timestamp('2011-01-01'), pd.Timestamp('2011-01-01')])
297291
b = np.array([pd.Timestamp('2011-01-01'), pd.Timestamp('2011-01-02')])
298292

0 commit comments

Comments
 (0)