Skip to content

Commit 0e29c4b

Browse files
TST: nose.Skiptest on RemoteDataErrors in tests for io.data.Options
Added to release notes Added to release notes Fixed warning tests for RemoteDataError TST: nose.Skiptest on RemoteDataErrors in tests for io.data.Options Added to release notes Conflicts: doc/source/release.rst
1 parent 09f23c8 commit 0e29c4b

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

doc/source/release.rst

+1
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ Bug Fixes
457457
- Bug causing UnicodeEncodeError when get_dummies called with unicode values and a prefix (:issue:`6885`)
458458
- Bug in timeseries-with-frequency plot cursor display (:issue:`5453`)
459459
- Bug surfaced in groupby.plot when using a ``Float64Index`` (:issue:`7025`)
460+
- Stopped tests from failing if options data isn't able to be downloaded from Yahoo (:issue:`7034`)
460461

461462
pandas 0.13.1
462463
-------------

pandas/io/tests/test_data.py

+17-17
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import pandas as pd
1010
from pandas import DataFrame
1111
from pandas.io import data as web
12-
from pandas.io.data import DataReader, SymbolWarning
12+
from pandas.io.data import DataReader, SymbolWarning, RemoteDataError
1313
from pandas.util.testing import (assert_series_equal, assert_produces_warning,
1414
network, assert_frame_equal)
1515
import pandas.util.testing as tm
@@ -252,8 +252,8 @@ def tearDownClass(cls):
252252
def test_get_options_data(self):
253253
try:
254254
calls, puts = self.aapl.get_options_data(expiry=self.expiry)
255-
except IndexError:
256-
warnings.warn("IndexError thrown no tables found")
255+
except RemoteDataError as e:
256+
nose.SkipTest(e)
257257
else:
258258
assert len(calls)>1
259259
assert len(puts)>1
@@ -269,8 +269,8 @@ def test_get_near_stock_price(self):
269269
try:
270270
calls, puts = self.aapl.get_near_stock_price(call=True, put=True,
271271
expiry=self.expiry)
272-
except IndexError:
273-
warnings.warn("IndexError thrown no tables found")
272+
except RemoteDataError as e:
273+
nose.SkipTest(e)
274274
else:
275275
self.assertEqual(len(calls), 5)
276276
self.assertEqual(len(puts), 5)
@@ -279,17 +279,17 @@ def test_get_near_stock_price(self):
279279
def test_get_call_data(self):
280280
try:
281281
calls = self.aapl.get_call_data(expiry=self.expiry)
282-
except IndexError:
283-
warnings.warn("IndexError thrown no tables found")
282+
except RemoteDataError as e:
283+
nose.SkipTest(e)
284284
else:
285285
assert len(calls)>1
286286

287287
@network
288288
def test_get_put_data(self):
289289
try:
290290
puts = self.aapl.get_put_data(expiry=self.expiry)
291-
except IndexError:
292-
warnings.warn("IndexError thrown no tables found")
291+
except RemoteDataError as e:
292+
nose.SkipTest(e)
293293
else:
294294
assert len(puts)>1
295295

@@ -321,8 +321,8 @@ def test_get_options_data_warning(self):
321321
print('month: {0}, year: {1}'.format(self.month, self.year))
322322
try:
323323
self.aapl.get_options_data(month=self.month, year=self.year)
324-
except IndexError:
325-
warnings.warn("IndexError thrown no tables found")
324+
except RemoteDataError as e:
325+
nose.SkipTest(e)
326326

327327
@network
328328
def test_get_near_stock_price_warning(self):
@@ -333,26 +333,26 @@ def test_get_near_stock_price_warning(self):
333333
put=True,
334334
month=self.month,
335335
year=self.year)
336-
except IndexError:
337-
warnings.warn("IndexError thrown no tables found")
336+
except RemoteDataError as e:
337+
nose.SkipTest(e)
338338

339339
@network
340340
def test_get_call_data_warning(self):
341341
with assert_produces_warning():
342342
print('month: {0}, year: {1}'.format(self.month, self.year))
343343
try:
344344
self.aapl.get_call_data(month=self.month, year=self.year)
345-
except IndexError:
346-
warnings.warn("IndexError thrown no tables found")
345+
except RemoteDataError as e:
346+
nose.SkipTest(e)
347347

348348
@network
349349
def test_get_put_data_warning(self):
350350
with assert_produces_warning():
351351
print('month: {0}, year: {1}'.format(self.month, self.year))
352352
try:
353353
self.aapl.get_put_data(month=self.month, year=self.year)
354-
except IndexError:
355-
warnings.warn("IndexError thrown no tables found")
354+
except RemoteDataError as e:
355+
nose.SkipTest(e)
356356

357357

358358
class TestDataReader(tm.TestCase):

0 commit comments

Comments
 (0)