Skip to content

Commit 7308577

Browse files
WillAydjreback
authored andcommitted
Removed old xarr and ipython decorators (#18814)
1 parent b5f1e71 commit 7308577

File tree

4 files changed

+7
-23
lines changed

4 files changed

+7
-23
lines changed

pandas/tests/generic/test_frame.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
assert_almost_equal)
1818

1919
import pandas.util.testing as tm
20+
import pandas.util._test_decorators as td
2021
from .test_generic import Generic
2122

2223
try:
@@ -218,8 +219,8 @@ def test_to_xarray_index_types(self, index):
218219
assert_frame_equal(result.to_dataframe(), expected,
219220
check_index_type=False, check_categorical=False)
220221

222+
@td.skip_if_no('xarray', min_version='0.7.0')
221223
def test_to_xarray(self):
222-
tm._skip_if_no_xarray()
223224
from xarray import Dataset
224225

225226
df = DataFrame({'a': list('abc'),

pandas/tests/generic/test_panel.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
assert_almost_equal)
1212

1313
import pandas.util.testing as tm
14+
import pandas.util._test_decorators as td
1415
from .test_generic import Generic
1516

1617

1718
class TestPanel(Generic):
1819
_typ = Panel
1920
_comparator = lambda self, x, y: assert_panel_equal(x, y, by_blocks=True)
2021

22+
@td.skip_if_no('xarray', min_version='0.7.0')
2123
def test_to_xarray(self):
22-
23-
tm._skip_if_no_xarray()
2424
from xarray import DataArray
2525

2626
with catch_warnings(record=True):
@@ -44,9 +44,8 @@ class TestPanel4D(Generic):
4444
def test_sample(self):
4545
pytest.skip("sample on Panel4D")
4646

47+
@td.skip_if_no('xarray', min_version='0.7.0')
4748
def test_to_xarray(self):
48-
49-
tm._skip_if_no_xarray()
5049
from xarray import DataArray
5150

5251
with catch_warnings(record=True):

pandas/tests/generic/test_series.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
assert_almost_equal)
1616

1717
import pandas.util.testing as tm
18+
import pandas.util._test_decorators as td
1819
from .test_generic import Generic
1920

2021
try:
@@ -200,9 +201,8 @@ def test_to_xarray_index_types(self, index):
200201
check_index_type=False,
201202
check_categorical=True)
202203

204+
@td.skip_if_no('xarray', min_version='0.7.0')
203205
def test_to_xarray(self):
204-
205-
tm._skip_if_no_xarray()
206206
from xarray import DataArray
207207

208208
s = Series([])

pandas/util/testing.py

-16
Original file line numberDiff line numberDiff line change
@@ -348,17 +348,6 @@ def _skip_if_no_lzma():
348348
return _check_if_lzma() or pytest.skip('need backports.lzma to run')
349349

350350

351-
def _skip_if_no_xarray():
352-
import pytest
353-
354-
xarray = pytest.importorskip("xarray")
355-
v = xarray.__version__
356-
357-
if LooseVersion(v) < LooseVersion('0.7.0'):
358-
import pytest
359-
pytest.skip("xarray version is too low: {version}".format(version=v))
360-
361-
362351
def skip_if_no_ne(engine='numexpr'):
363352
from pandas.core.computation.expressions import (
364353
_USE_NUMEXPR,
@@ -383,11 +372,6 @@ def _skip_if_no_mock():
383372
import pytest
384373
raise pytest.skip("mock is not installed")
385374

386-
387-
def _skip_if_no_ipython():
388-
import pytest
389-
pytest.importorskip("IPython")
390-
391375
# -----------------------------------------------------------------------------
392376
# locale utilities
393377

0 commit comments

Comments
 (0)