Skip to content

Commit e231da4

Browse files
author
y-p
committed
Merge pull request #4320 from y-p/GH3376
TST: skip some tests if scikits is installed but not scipy GH3376
2 parents 5c88771 + 2cad879 commit e231da4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/stats/tests/test_moments.py

+12
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
N, K = 100, 10
2020

21+
def _skip_if_no_scipy():
22+
try:
23+
import scipy.stats
24+
except ImportError:
25+
raise nose.SkipTest
2126

2227
class TestMoments(unittest.TestCase):
2328

@@ -64,6 +69,7 @@ def test_rolling_mean(self):
6469
self._check_moment_func(mom.rolling_mean, np.mean)
6570

6671
def test_cmov_mean(self):
72+
_skip_if_no_scipy()
6773
try:
6874
from scikits.timeseries.lib import cmov_mean
6975
except ImportError:
@@ -81,6 +87,7 @@ def test_cmov_mean(self):
8187
assert_series_equal(xp, rs)
8288

8389
def test_cmov_window(self):
90+
_skip_if_no_scipy()
8491
try:
8592
from scikits.timeseries.lib import cmov_window
8693
except ImportError:
@@ -98,6 +105,7 @@ def test_cmov_window(self):
98105
assert_series_equal(xp, rs)
99106

100107
def test_cmov_window_corner(self):
108+
_skip_if_no_scipy()
101109
try:
102110
from scikits.timeseries.lib import cmov_window
103111
except ImportError:
@@ -121,6 +129,7 @@ def test_cmov_window_corner(self):
121129
self.assert_(len(rs) == 5)
122130

123131
def test_cmov_window_frame(self):
132+
_skip_if_no_scipy()
124133
try:
125134
from scikits.timeseries.lib import cmov_window
126135
except ImportError:
@@ -133,6 +142,7 @@ def test_cmov_window_frame(self):
133142
assert_frame_equal(DataFrame(xp), rs)
134143

135144
def test_cmov_window_na_min_periods(self):
145+
_skip_if_no_scipy()
136146
try:
137147
from scikits.timeseries.lib import cmov_window
138148
except ImportError:
@@ -149,6 +159,7 @@ def test_cmov_window_na_min_periods(self):
149159
assert_series_equal(xp, rs)
150160

151161
def test_cmov_window_regular(self):
162+
_skip_if_no_scipy()
152163
try:
153164
from scikits.timeseries.lib import cmov_window
154165
except ImportError:
@@ -164,6 +175,7 @@ def test_cmov_window_regular(self):
164175
assert_series_equal(Series(xp), rs)
165176

166177
def test_cmov_window_special(self):
178+
_skip_if_no_scipy()
167179
try:
168180
from scikits.timeseries.lib import cmov_window
169181
except ImportError:

0 commit comments

Comments
 (0)