Skip to content

Commit

Permalink
TST: pytest deprecation warnings GH17197
Browse files Browse the repository at this point in the history
  • Loading branch information
swyoon committed Aug 15, 2017
1 parent 0f25426 commit 3659e88
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 17 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.21.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -386,3 +386,4 @@ Other
- Bug in :func:`eval` where the ``inplace`` parameter was being incorrectly handled (:issue:`16732`)
- Bug in ``.isin()`` in which checking membership in empty ``Series`` objects raised an error (:issue:`16991`)
- Bug in :func:`unique` where checking a tuple of strings raised a ``TypeError`` (:issue:`17108`)
- Fixes RemovedInPytest4Warning by using pytest.param(..., marks=...) (:issue:`17197`)
15 changes: 8 additions & 7 deletions pandas/tests/computation/test_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@


@pytest.fixture(params=(
pytest.mark.skipif(engine == 'numexpr' and not _USE_NUMEXPR,
reason='numexpr enabled->{enabled}, '
'installed->{installed}'.format(
enabled=_USE_NUMEXPR,
installed=_NUMEXPR_INSTALLED))(engine)
for engine in _engines # noqa
))
pytest.param(engine,
marks=pytest.mark.skipif(
engine == 'numexpr' and not _USE_NUMEXPR,
reason='numexpr enabled->{enabled}, '
'installed->{installed}'.format(
enabled=_USE_NUMEXPR,
installed=_NUMEXPR_INSTALLED)))
for engine in _engines)) # noqa
def engine(request):
return request.param

Expand Down
6 changes: 4 additions & 2 deletions pandas/tests/io/parser/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ def salaries_table():
@pytest.mark.parametrize(
"compression,extension",
[('gzip', '.gz'), ('bz2', '.bz2'), ('zip', '.zip'),
pytest.mark.skipif(not tm._check_if_lzma(),
reason='need backports.lzma to run')(('xz', '.xz'))])
pytest.param('xz', '.xz',
marks=pytest.mark.skipif(not tm._check_if_lzma(),
reason='need backports.lzma '
'to run'))])
@pytest.mark.parametrize('mode', ['explicit', 'infer'])
@pytest.mark.parametrize('engine', ['python', 'c'])
def test_compressed_urls(salaries_table, compression, extension, mode, engine):
Expand Down
6 changes: 4 additions & 2 deletions pandas/tests/io/test_excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2400,8 +2400,10 @@ def check_called(func):


@pytest.mark.parametrize('engine', [
pytest.mark.xfail('xlwt', reason='xlwt does not support '
'openpyxl-compatible style dicts'),
pytest.param('xlwt',
marks=pytest.mark.xfail(reason='xlwt does not support '
'openpyxl-compatible '
'style dicts')),
'xlsxwriter',
'openpyxl',
])
Expand Down
12 changes: 8 additions & 4 deletions pandas/tests/io/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@

# setup engines & skips
@pytest.fixture(params=[
pytest.mark.skipif(not _HAVE_FASTPARQUET,
reason='fastparquet is not installed')('fastparquet'),
pytest.mark.skipif(not _HAVE_PYARROW,
reason='pyarrow is not installed')('pyarrow')])
pytest.param('fastparquet',
marks=pytest.mark.skipif(not _HAVE_FASTPARQUET,
reason='fastparquet is '
'not installed')),
pytest.param('pyarrow',
marks=pytest.mark.skipif(not _HAVE_PYARROW,
reason='pyarrow is '
'not installed'))])
def engine(request):
return request.param

Expand Down
5 changes: 3 additions & 2 deletions pandas/tests/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,9 @@ def test_numpy_compat(self):

@pytest.mark.parametrize(
'expander',
[1, pytest.mark.xfail(
reason='GH 16425 expanding with offset not supported')('1s')])
[1, pytest.param('ls', marks=pytest.mark.xfail(
reason='GH 16425 expanding with '
'offset not supported'))])
def test_empty_df_expanding(self, expander):
# GH 15819 Verifies that datetime and integer expanding windows can be
# applied to empty DataFrames
Expand Down

0 comments on commit 3659e88

Please sign in to comment.