Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20 internet doctests failed in sage/finance/stock.py #25473

Closed
seblabbe opened this issue May 30, 2018 · 13 comments
Closed

20 internet doctests failed in sage/finance/stock.py #25473

seblabbe opened this issue May 30, 2018 · 13 comments

Comments

@seblabbe
Copy link
Contributor

As reported on sage-release 8.3.beta3,

sage -t --optional=sage,internet src/sage/finance/stock.py

gives

Running doctests with ID 2018-05-30-22-48-41-52141b2a.
Using --optional=internet,sage
Doctesting 1 file.
sage -t --warn-long 82.6 src/sage/finance/stock.py
**********************************************************************
File "src/sage/finance/stock.py", line 156, in sage.finance.stock.Stock.__init__
Failed example:
    S        # optional -- internet
Expected:
    IBM (...)
Got:
    <repr(<instance at 0x7f2fcce08680>) failed: URLError: <urlopen error [Errno -2] Name or service not known>>
**********************************************************************
...
**********************************************************************
File "src/sage/finance/stock.py", line 626, in sage.finance.stock.Stock._get_data
Failed example:
    finance.Stock('whatever').history() # optional -- internet
Expected:
    Traceback (most recent call last):
    ...
    RuntimeError: Google reported a wrong request (did you specify a cid?)
Got:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 562, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 972, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.finance.stock.Stock._get_data[1]>", line 1, in <module>
        finance.Stock('whatever').history() # optional -- internet
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/finance/stock.py", line 385, in history
        R = self._get_data('NASDAQ:', startdate, enddate, histperiod)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/finance/stock.py", line 637, in _get_data
        data = urlopen(url).read()
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/urllib2.py", line 154, in urlopen
        return opener.open(url, data, timeout)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/urllib2.py", line 435, in open
        response = meth(req, response)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/urllib2.py", line 548, in http_response
        'http', request, response, code, msg, hdrs)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/urllib2.py", line 473, in error
        return self._call_chain(*args)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/urllib2.py", line 407, in _call_chain
        result = func(*args)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/urllib2.py", line 556, in http_error_default
        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    HTTPError: HTTP Error 403: Forbidden
**********************************************************************
8 items had failures:
   1 of   3 in sage.finance.stock.Stock.__init__
   1 of   2 in sage.finance.stock.Stock.__repr__
   2 of   3 in sage.finance.stock.Stock._get_data
   4 of   6 in sage.finance.stock.Stock.close
   2 of   3 in sage.finance.stock.Stock.current_price_data
   5 of   6 in sage.finance.stock.Stock.history
   1 of   2 in sage.finance.stock.Stock.market_value
   4 of   6 in sage.finance.stock.Stock.open
    [43 tests, 20 failures, 10.21 s]
----------------------------------------------------------------------
sage -t --warn-long 82.6 src/sage/finance/stock.py  # 20 doctests failed
----------------------------------------------------------------------
Total time for all tests: 10.2 seconds
    cpu time: 0.4 seconds
    cumulative wall time: 10.2 seconds

Full log on framabin against 8.5.beta0.

This ticket marks the tests as "known bug".

Related tickets:

Component: finance

Author: Sébastien Labbé

Branch: 268d9be

Reviewer: Frédéric Chapoton

Issue created by migration from https://trac.sagemath.org/ticket/25473

@seblabbe seblabbe added this to the sage-8.3 milestone May 30, 2018
@seblabbe

This comment has been minimized.

@seblabbe
Copy link
Contributor Author

comment:2

Updated framabin link to include only failures related to finance/stock.py file

@seblabbe

This comment has been minimized.

@slel
Copy link
Member

slel commented Oct 26, 2018

comment:3

It seems the "Yahoo! Finance" service which allowed to get csv files was disabled
in May 2017. I don't see any replacement.

@seblabbe
Copy link
Contributor Author

comment:4

The module Stock is completely broken. We could just delete it. For now, I suggest to add the #known bug tag to broken optional internet doctests.

Other motivated people could eventually open another ticket to fix the code or deprecate/delete the code.

Meanwhile, let's stop this file from creating noise when running doctests.


New commits:

268d9be25473: (stock.py) adding known bug tag to broken optional doctests

@seblabbe
Copy link
Contributor Author

Author: Sébastien Labbé

@seblabbe
Copy link
Contributor Author

Commit: 268d9be

@seblabbe
Copy link
Contributor Author

Branch: u/slabbe/25473

@fchapoton
Copy link
Contributor

Reviewer: Frédéric Chapoton

@fchapoton
Copy link
Contributor

comment:5

ok. I would vote for the complete removal.

@vbraun
Copy link
Member

vbraun commented Nov 23, 2018

Changed branch from u/slabbe/25473 to 268d9be

@slel
Copy link
Member

slel commented Nov 24, 2018

Changed commit from 268d9be to none

@slel

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants