Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#25473 closed defect (fixed)

20 internet doctests failed in sage/finance/

Reported by: slabbe Owned by:
Priority: major Milestone: sage-8.5
Component: finance Keywords:
Cc: Merged in:
Authors: Sébastien Labbé Reviewers: Frédéric Chapoton
Report Upstream: N/A Work issues:
Branch: 268d9be (Commits, GitHub, GitLab) Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by slelievre)

As reported on sage-release 8.3.beta3,

sage -t --optional=sage,internet src/sage/finance/


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/
File "src/sage/finance/", line 156, in
Failed example:
    S        # optional -- internet
    IBM (...)
    <repr(<instance at 0x7f2fcce08680>) failed: URLError: <urlopen error [Errno -2] Name or service not known>>
File "src/sage/finance/", line 626, in
Failed example:
    finance.Stock('whatever').history() # optional -- internet
    Traceback (most recent call last):
    RuntimeError: Google reported a wrong request (did you specify a cid?)
    Traceback (most recent call last):
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/doctest/", 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/", line 972, in compile_and_execute
        exec(compiled, globs)
      File "<doctest[1]>", line 1, in <module>
        finance.Stock('whatever').history() # optional -- internet
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/site-packages/sage/finance/", 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/", line 637, in _get_data
        data = urlopen(url).read()
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/", line 154, in urlopen
        return, data, timeout)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/", line 435, in open
        response = meth(req, response)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/", line 548, in http_response
        'http', request, response, code, msg, hdrs)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/", line 473, in error
        return self._call_chain(*args)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/", line 407, in _call_chain
        result = func(*args)
      File "/home/slabbe/GitBox/sage/local/lib/python2.7/", 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
   1 of   2 in
   2 of   3 in
   4 of   6 in
   2 of   3 in
   5 of   6 in
   1 of   2 in
   4 of   6 in
    [43 tests, 20 failures, 10.21 s]
sage -t --warn-long 82.6 src/sage/finance/  # 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:

  • #25425: finance.Stock -- obtaining stock prices from Google is completely broken now
  • #26754: Remove or replace calls to Yahoo! Finance in sage/finance/

Change History (8)

comment:1 Changed 4 years ago by slabbe

  • Description modified (diff)

comment:2 Changed 3 years ago by slabbe

  • Description modified (diff)

Updated framabin link to include only failures related to finance/ file

Last edited 3 years ago by slabbe (previous) (diff)

comment:3 Changed 3 years ago by slelievre

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

comment:4 Changed 3 years ago by slabbe

  • Authors set to Sébastien Labbé
  • Branch set to u/slabbe/25473
  • Commit set to 268d9be19b683a889726022100d15271659f9760
  • Status changed from new to needs_review

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: ( adding known bug tag to broken optional doctests

comment:5 Changed 3 years ago by chapoton

  • Reviewers set to Frédéric Chapoton
  • Status changed from needs_review to positive_review

ok. I would vote for the complete removal.

comment:6 Changed 3 years ago by chapoton

  • Milestone changed from sage-8.3 to sage-8.5

comment:7 Changed 3 years ago by vbraun

  • Branch changed from u/slabbe/25473 to 268d9be19b683a889726022100d15271659f9760
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:8 Changed 3 years ago by slelievre

  • Commit 268d9be19b683a889726022100d15271659f9760 deleted
  • Description modified (diff)
Note: See TracTickets for help on using tickets.