Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
more retries for a unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed May 6, 2018
1 parent fd7d291 commit 6a893a3
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions _unittests/ut_finance/test_stock_url_yahoo.py
Expand Up @@ -48,13 +48,23 @@ def test_download_stock_yahoo(self):
self._testMethodName,
OutputPrint=__name__ == "__main__")
cache = get_temp_folder(__file__, "temp_url_yahoo")
stock = StockPrices("^FCHI", folder=cache, url="yahoo",
begin=datetime.datetime(2014, 1, 15))
df = stock.dataframe
dmin = df.Date.min()
self.assertIn("2014", str(dmin))
if "^FCHI.2014-01-15" not in stock.url_:
raise AssertionError(stock.url_)
exc = []
for n in range(0, 4):
stock = StockPrices("^FCHI", folder=cache, url="yahoo",
begin=datetime.datetime(2014, 1, 15))
df = stock.dataframe
dmin, dmax = df.Date.min(), df.Date.max()
try:
self.assertIn("2014", str(dmin))
self.assertNotEqual(dmin, dmax)
if "^FCHI.2014-01-15" not in stock.url_:
raise AssertionError(stock.url_)
return
except AssertionError as e:
exc.append(e)
if len(exc) > 0:
e = exc[0]
raise AssertionError('nb tries={0}'.format(len(exc))) from e


if __name__ == "__main__":
Expand Down

0 comments on commit 6a893a3

Please sign in to comment.