Skip to content

Commit 3659e88

Browse files
committed
TST: pytest deprecation warnings GH17197
Test parameters with marks are updated according to the updated API of Pytest. https://docs.pytest.org/en/latest/changelog.html#pytest-3-2-0-2017-07-30 https://docs.pytest.org/en/latest/parametrize.html
1 parent 0f25426 commit 3659e88

File tree

6 files changed

+28
-17
lines changed

6 files changed

+28
-17
lines changed

doc/source/whatsnew/v0.21.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -386,3 +386,4 @@ Other
386386
- Bug in :func:`eval` where the ``inplace`` parameter was being incorrectly handled (:issue:`16732`)
387387
- Bug in ``.isin()`` in which checking membership in empty ``Series`` objects raised an error (:issue:`16991`)
388388
- Bug in :func:`unique` where checking a tuple of strings raised a ``TypeError`` (:issue:`17108`)
389+
- Fixes RemovedInPytest4Warning by using pytest.param(..., marks=...) (:issue:`17197`)

pandas/tests/computation/test_eval.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@
3838

3939

4040
@pytest.fixture(params=(
41-
pytest.mark.skipif(engine == 'numexpr' and not _USE_NUMEXPR,
42-
reason='numexpr enabled->{enabled}, '
43-
'installed->{installed}'.format(
44-
enabled=_USE_NUMEXPR,
45-
installed=_NUMEXPR_INSTALLED))(engine)
46-
for engine in _engines # noqa
47-
))
41+
pytest.param(engine,
42+
marks=pytest.mark.skipif(
43+
engine == 'numexpr' and not _USE_NUMEXPR,
44+
reason='numexpr enabled->{enabled}, '
45+
'installed->{installed}'.format(
46+
enabled=_USE_NUMEXPR,
47+
installed=_NUMEXPR_INSTALLED)))
48+
for engine in _engines)) # noqa
4849
def engine(request):
4950
return request.param
5051

pandas/tests/io/parser/test_network.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ def salaries_table():
2323
@pytest.mark.parametrize(
2424
"compression,extension",
2525
[('gzip', '.gz'), ('bz2', '.bz2'), ('zip', '.zip'),
26-
pytest.mark.skipif(not tm._check_if_lzma(),
27-
reason='need backports.lzma to run')(('xz', '.xz'))])
26+
pytest.param('xz', '.xz',
27+
marks=pytest.mark.skipif(not tm._check_if_lzma(),
28+
reason='need backports.lzma '
29+
'to run'))])
2830
@pytest.mark.parametrize('mode', ['explicit', 'infer'])
2931
@pytest.mark.parametrize('engine', ['python', 'c'])
3032
def test_compressed_urls(salaries_table, compression, extension, mode, engine):

pandas/tests/io/test_excel.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -2400,8 +2400,10 @@ def check_called(func):
24002400

24012401

24022402
@pytest.mark.parametrize('engine', [
2403-
pytest.mark.xfail('xlwt', reason='xlwt does not support '
2404-
'openpyxl-compatible style dicts'),
2403+
pytest.param('xlwt',
2404+
marks=pytest.mark.xfail(reason='xlwt does not support '
2405+
'openpyxl-compatible '
2406+
'style dicts')),
24052407
'xlsxwriter',
24062408
'openpyxl',
24072409
])

pandas/tests/io/test_parquet.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@
2626

2727
# setup engines & skips
2828
@pytest.fixture(params=[
29-
pytest.mark.skipif(not _HAVE_FASTPARQUET,
30-
reason='fastparquet is not installed')('fastparquet'),
31-
pytest.mark.skipif(not _HAVE_PYARROW,
32-
reason='pyarrow is not installed')('pyarrow')])
29+
pytest.param('fastparquet',
30+
marks=pytest.mark.skipif(not _HAVE_FASTPARQUET,
31+
reason='fastparquet is '
32+
'not installed')),
33+
pytest.param('pyarrow',
34+
marks=pytest.mark.skipif(not _HAVE_PYARROW,
35+
reason='pyarrow is '
36+
'not installed'))])
3337
def engine(request):
3438
return request.param
3539

pandas/tests/test_window.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,9 @@ def test_numpy_compat(self):
530530

531531
@pytest.mark.parametrize(
532532
'expander',
533-
[1, pytest.mark.xfail(
534-
reason='GH 16425 expanding with offset not supported')('1s')])
533+
[1, pytest.param('ls', marks=pytest.mark.xfail(
534+
reason='GH 16425 expanding with '
535+
'offset not supported'))])
535536
def test_empty_df_expanding(self, expander):
536537
# GH 15819 Verifies that datetime and integer expanding windows can be
537538
# applied to empty DataFrames

0 commit comments

Comments
 (0)