Skip to content

Commit 9d13227

Browse files
TomAugspurgerjreback
authored andcommitted
TST/PKG: Removed pandas.util.testing.slow definition (#16852)
1 parent a9421af commit 9d13227

19 files changed

+239
-249
lines changed

doc/source/whatsnew/v0.21.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ the target. Now, a ``ValueError`` will be raised when such an input is passed in
101101
- :class:`pandas.HDFStore`'s string representation is now faster and less detailed. For the previous behavior, use ``pandas.HDFStore.info()``. (:issue:`16503`).
102102
- Compression defaults in HDF stores now follow pytable standards. Default is no compression and if ``complib`` is missing and ``complevel`` > 0 ``zlib`` is used (:issue:`15943`)
103103
- ``Index.get_indexer_non_unique()`` now returns a ndarray indexer rather than an ``Index``; this is consistent with ``Index.get_indexer()`` (:issue:`16819`)
104+
- Removed the ``@slow`` decorator from ``pandas.util.testing``, which caused issues for some downstream packages' test suites. Use ``@pytest.mark.slow`` instead, which achieves the same thing (:issue:`16850`)
104105

105106
.. _whatsnew_0210.api:
106107

pandas/tests/computation/test_eval.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import pandas.util.testing as tm
3131
from pandas.util.testing import (assert_frame_equal, randbool,
3232
assert_numpy_array_equal, assert_series_equal,
33-
assert_produces_warning, slow)
33+
assert_produces_warning)
3434
from pandas.compat import PY3, reduce
3535

3636
_series_frame_incompatible = _bool_ops_syms
@@ -144,7 +144,7 @@ def teardown_method(self, method):
144144
del self.lhses, self.rhses, self.scalar_rhses, self.scalar_lhses
145145
del self.pandas_rhses, self.pandas_lhses, self.current_engines
146146

147-
@slow
147+
@pytest.mark.slow
148148
def test_complex_cmp_ops(self):
149149
cmp_ops = ('!=', '==', '<=', '>=', '<', '>')
150150
cmp2_ops = ('>', '<')
@@ -161,7 +161,7 @@ def test_simple_cmp_ops(self):
161161
for lhs, rhs, cmp_op in product(bool_lhses, bool_rhses, self.cmp_ops):
162162
self.check_simple_cmp_op(lhs, cmp_op, rhs)
163163

164-
@slow
164+
@pytest.mark.slow
165165
def test_binary_arith_ops(self):
166166
for lhs, op, rhs in product(self.lhses, self.arith_ops, self.rhses):
167167
self.check_binary_arith_op(lhs, op, rhs)
@@ -181,17 +181,17 @@ def test_pow(self):
181181
for lhs, rhs in product(self.lhses, self.rhses):
182182
self.check_pow(lhs, '**', rhs)
183183

184-
@slow
184+
@pytest.mark.slow
185185
def test_single_invert_op(self):
186186
for lhs, op, rhs in product(self.lhses, self.cmp_ops, self.rhses):
187187
self.check_single_invert_op(lhs, op, rhs)
188188

189-
@slow
189+
@pytest.mark.slow
190190
def test_compound_invert_op(self):
191191
for lhs, op, rhs in product(self.lhses, self.cmp_ops, self.rhses):
192192
self.check_compound_invert_op(lhs, op, rhs)
193193

194-
@slow
194+
@pytest.mark.slow
195195
def test_chained_cmp_op(self):
196196
mids = self.lhses
197197
cmp_ops = '<', '>'
@@ -870,7 +870,7 @@ def test_frame_comparison(self, engine, parser):
870870
res = pd.eval('df < df3', engine=engine, parser=parser)
871871
assert_frame_equal(res, df < df3)
872872

873-
@slow
873+
@pytest.mark.slow
874874
def test_medium_complex_frame_alignment(self, engine, parser):
875875
args = product(self.lhs_index_types, self.index_types,
876876
self.index_types, self.index_types)
@@ -974,7 +974,7 @@ def test_series_frame_commutativity(self, engine, parser):
974974
if engine == 'numexpr':
975975
assert_frame_equal(a, b)
976976

977-
@slow
977+
@pytest.mark.slow
978978
def test_complex_series_frame_alignment(self, engine, parser):
979979
import random
980980
args = product(self.lhs_index_types, self.index_types,

pandas/tests/frame/test_repr_info.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from numpy import nan
1010
import numpy as np
11+
import pytest
1112

1213
from pandas import (DataFrame, compat, option_context)
1314
from pandas.compat import StringIO, lrange, u
@@ -40,7 +41,7 @@ def test_repr_mixed(self):
4041
foo = repr(self.mixed_frame) # noqa
4142
self.mixed_frame.info(verbose=False, buf=buf)
4243

43-
@tm.slow
44+
@pytest.mark.slow
4445
def test_repr_mixed_big(self):
4546
# big mixed
4647
biggie = DataFrame({'A': np.random.randn(200),
@@ -87,7 +88,7 @@ def test_repr_dimensions(self):
8788
with option_context('display.show_dimensions', 'truncate'):
8889
assert "2 rows x 2 columns" not in repr(df)
8990

90-
@tm.slow
91+
@pytest.mark.slow
9192
def test_repr_big(self):
9293
# big one
9394
biggie = DataFrame(np.zeros((200, 4)), columns=lrange(4),

pandas/tests/frame/test_to_csv.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from pandas.util.testing import (assert_almost_equal,
1818
assert_series_equal,
1919
assert_frame_equal,
20-
ensure_clean, slow,
20+
ensure_clean,
2121
makeCustomDataframe as mkdf)
2222
import pandas.util.testing as tm
2323

@@ -205,7 +205,7 @@ def _check_df(df, cols=None):
205205
cols = ['b', 'a']
206206
_check_df(df, cols)
207207

208-
@slow
208+
@pytest.mark.slow
209209
def test_to_csv_dtnat(self):
210210
# GH3437
211211
from pandas import NaT
@@ -236,7 +236,7 @@ def make_dtnat_arr(n, nnat=None):
236236
assert_frame_equal(df, recons, check_names=False,
237237
check_less_precise=True)
238238

239-
@slow
239+
@pytest.mark.slow
240240
def test_to_csv_moar(self):
241241

242242
def _do_test(df, r_dtype=None, c_dtype=None,
@@ -728,7 +728,7 @@ def test_to_csv_chunking(self):
728728
rs = read_csv(filename, index_col=0)
729729
assert_frame_equal(rs, aa)
730730

731-
@slow
731+
@pytest.mark.slow
732732
def test_to_csv_wide_frame_formatting(self):
733733
# Issue #8621
734734
df = DataFrame(np.random.randn(1, 100010), columns=None, index=None)

pandas/tests/indexing/test_indexing_slow.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
import pandas as pd
77
from pandas.core.api import Series, DataFrame, MultiIndex
88
import pandas.util.testing as tm
9+
import pytest
910

1011

1112
class TestIndexingSlow(object):
1213

13-
@tm.slow
14+
@pytest.mark.slow
1415
def test_multiindex_get_loc(self): # GH7724, GH2646
1516

1617
with warnings.catch_warnings(record=True):
@@ -80,15 +81,15 @@ def loop(mi, df, keys):
8081
assert not mi.index.lexsort_depth < i
8182
loop(mi, df, keys)
8283

83-
@tm.slow
84+
@pytest.mark.slow
8485
def test_large_dataframe_indexing(self):
8586
# GH10692
8687
result = DataFrame({'x': range(10 ** 6)}, dtype='int64')
8788
result.loc[len(result)] = len(result) + 1
8889
expected = DataFrame({'x': range(10 ** 6 + 1)}, dtype='int64')
8990
tm.assert_frame_equal(result, expected)
9091

91-
@tm.slow
92+
@pytest.mark.slow
9293
def test_large_mi_dataframe_indexing(self):
9394
# GH10645
9495
result = MultiIndex.from_arrays([range(10 ** 6), range(10 ** 6)])

pandas/tests/io/parser/common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ def test_url(self):
664664
tm.assert_frame_equal(url_table, local_table)
665665
# TODO: ftp testing
666666

667-
@tm.slow
667+
@pytest.mark.slow
668668
def test_file(self):
669669
dirpath = tm.get_data_path()
670670
localtable = os.path.join(dirpath, 'salaries.csv')

pandas/tests/io/test_excel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ def test_read_from_s3_url(self):
614614
local_table = self.get_exceldf('test1')
615615
tm.assert_frame_equal(url_table, local_table)
616616

617-
@tm.slow
617+
@pytest.mark.slow
618618
def test_read_from_file_url(self):
619619

620620
# FILE

pandas/tests/io/test_html.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def test_spam_url(self):
130130

131131
assert_framelist_equal(df1, df2)
132132

133-
@tm.slow
133+
@pytest.mark.slow
134134
def test_banklist(self):
135135
df1 = self.read_html(self.banklist_data, '.*Florida.*',
136136
attrs={'id': 'table'})
@@ -292,7 +292,7 @@ def test_invalid_url(self):
292292
except ValueError as e:
293293
assert str(e) == 'No tables found'
294294

295-
@tm.slow
295+
@pytest.mark.slow
296296
def test_file_url(self):
297297
url = self.banklist_data
298298
dfs = self.read_html(file_path_to_url(url), 'First',
@@ -301,7 +301,7 @@ def test_file_url(self):
301301
for df in dfs:
302302
assert isinstance(df, DataFrame)
303303

304-
@tm.slow
304+
@pytest.mark.slow
305305
def test_invalid_table_attrs(self):
306306
url = self.banklist_data
307307
with tm.assert_raises_regex(ValueError, 'No tables found'):
@@ -312,39 +312,39 @@ def _bank_data(self, *args, **kwargs):
312312
return self.read_html(self.banklist_data, 'Metcalf',
313313
attrs={'id': 'table'}, *args, **kwargs)
314314

315-
@tm.slow
315+
@pytest.mark.slow
316316
def test_multiindex_header(self):
317317
df = self._bank_data(header=[0, 1])[0]
318318
assert isinstance(df.columns, MultiIndex)
319319

320-
@tm.slow
320+
@pytest.mark.slow
321321
def test_multiindex_index(self):
322322
df = self._bank_data(index_col=[0, 1])[0]
323323
assert isinstance(df.index, MultiIndex)
324324

325-
@tm.slow
325+
@pytest.mark.slow
326326
def test_multiindex_header_index(self):
327327
df = self._bank_data(header=[0, 1], index_col=[0, 1])[0]
328328
assert isinstance(df.columns, MultiIndex)
329329
assert isinstance(df.index, MultiIndex)
330330

331-
@tm.slow
331+
@pytest.mark.slow
332332
def test_multiindex_header_skiprows_tuples(self):
333333
df = self._bank_data(header=[0, 1], skiprows=1, tupleize_cols=True)[0]
334334
assert isinstance(df.columns, Index)
335335

336-
@tm.slow
336+
@pytest.mark.slow
337337
def test_multiindex_header_skiprows(self):
338338
df = self._bank_data(header=[0, 1], skiprows=1)[0]
339339
assert isinstance(df.columns, MultiIndex)
340340

341-
@tm.slow
341+
@pytest.mark.slow
342342
def test_multiindex_header_index_skiprows(self):
343343
df = self._bank_data(header=[0, 1], index_col=[0, 1], skiprows=1)[0]
344344
assert isinstance(df.index, MultiIndex)
345345
assert isinstance(df.columns, MultiIndex)
346346

347-
@tm.slow
347+
@pytest.mark.slow
348348
def test_regex_idempotency(self):
349349
url = self.banklist_data
350350
dfs = self.read_html(file_path_to_url(url),
@@ -372,7 +372,7 @@ def test_python_docs_table(self):
372372
zz = [df.iloc[0, 0][0:4] for df in dfs]
373373
assert sorted(zz) == sorted(['Repo', 'What'])
374374

375-
@tm.slow
375+
@pytest.mark.slow
376376
def test_thousands_macau_stats(self):
377377
all_non_nan_table_index = -2
378378
macau_data = os.path.join(DATA_PATH, 'macau.html')
@@ -382,7 +382,7 @@ def test_thousands_macau_stats(self):
382382

383383
assert not any(s.isnull().any() for _, s in df.iteritems())
384384

385-
@tm.slow
385+
@pytest.mark.slow
386386
def test_thousands_macau_index_col(self):
387387
all_non_nan_table_index = -2
388388
macau_data = os.path.join(DATA_PATH, 'macau.html')
@@ -523,7 +523,7 @@ def test_nyse_wsj_commas_table(self):
523523
assert df.shape[0] == nrows
524524
tm.assert_index_equal(df.columns, columns)
525525

526-
@tm.slow
526+
@pytest.mark.slow
527527
def test_banklist_header(self):
528528
from pandas.io.html import _remove_whitespace
529529

@@ -562,7 +562,7 @@ def try_remove_ws(x):
562562
coerce=True)
563563
tm.assert_frame_equal(converted, gtnew)
564564

565-
@tm.slow
565+
@pytest.mark.slow
566566
def test_gold_canyon(self):
567567
gc = 'Gold Canyon'
568568
with open(self.banklist_data, 'r') as f:
@@ -855,7 +855,7 @@ def test_works_on_valid_markup(self):
855855
assert isinstance(dfs, list)
856856
assert isinstance(dfs[0], DataFrame)
857857

858-
@tm.slow
858+
@pytest.mark.slow
859859
def test_fallback_success(self):
860860
_skip_if_none_of(('bs4', 'html5lib'))
861861
banklist_data = os.path.join(DATA_PATH, 'banklist.html')
@@ -898,7 +898,7 @@ def get_elements_from_file(url, element='table'):
898898
return soup.find_all(element)
899899

900900

901-
@tm.slow
901+
@pytest.mark.slow
902902
def test_bs4_finds_tables():
903903
filepath = os.path.join(DATA_PATH, "spam.html")
904904
with warnings.catch_warnings():
@@ -913,13 +913,13 @@ def get_lxml_elements(url, element):
913913
return doc.xpath('.//{0}'.format(element))
914914

915915

916-
@tm.slow
916+
@pytest.mark.slow
917917
def test_lxml_finds_tables():
918918
filepath = os.path.join(DATA_PATH, "spam.html")
919919
assert get_lxml_elements(filepath, 'table')
920920

921921

922-
@tm.slow
922+
@pytest.mark.slow
923923
def test_lxml_finds_tbody():
924924
filepath = os.path.join(DATA_PATH, "spam.html")
925925
assert get_lxml_elements(filepath, 'tbody')

0 commit comments

Comments
 (0)