Opened 9 years ago

Last modified 9 years ago

#14290 closed defect

Running doctests from within Sage doesn't work — at Version 4

Reported by: roed Owned by: mvngu
Priority: major Milestone: sage-5.9
Component: doctest framework Keywords:
Cc: Merged in:
Authors: David Roe Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #12415 Stopgaps:

Status badges

Description (last modified by roed)

Running doctests from within Sage results in any test that has output failing. For example:

sage: run_doctests(sage.algebras.algebra)
Doctesting /Users/roed/sage/sage-5.9.beta0/devel/sage/sage/algebras/
Running doctests with ID 2013-03-17-01-02-17-09f21e8e.
Doctesting 1 file.
sage -t /Users/roed/sage/sage-5.9.beta0/devel/sage/sage/algebras/
File "/Users/roed/sage/sage-5.9.beta0/devel/sage/sage/algebras/", line 29, in sage.algebras.algebra.is_Algebra
Failed example:
File "/Users/roed/sage/sage-5.9.beta0/devel/sage/sage/algebras/", line 31, in sage.algebras.algebra.is_Algebra
Failed example:
1 item had failures:
   2 of   4 in sage.algebras.algebra.is_Algebra
    [3 tests, 2 failures, 0.1 s]
sage -t /Users/roed/sage/sage-5.9.beta0/devel/sage/sage/algebras/  # 2 doctests failed
Total time for all tests: 0.1 seconds
    cpu time: 0.1 seconds
    cumulative wall time: 0.1 seconds

This is the result of IPython coloring the output.


Change History (5)

Changed 9 years ago by roed

comment:1 Changed 9 years ago by roed

  • Authors set to David Roe
  • Status changed from new to needs_review

I couldn't figure out a way to doctest this fix (since the problem only occurred when running doctests from IPython), but it's ready for review.

comment:2 Changed 9 years ago by roed

  • Dependencies set to #12415

comment:3 Changed 9 years ago by vbraun

  • Reviewers set to Volker Braun

Positive review to your patch.

I still think that it would be nice to have a note added to the diff that there were ansi escape sequences, since they don't get printed and you are otherwise just left with two identical strings which makes it non-obvious why the doctest failed. So I rescued that piece of the patch from #14359.

comment:4 Changed 9 years ago by roed

  • Description modified (diff)
  • Status changed from needs_review to positive_review

Your patch looks good too.

Note: See TracTickets for help on using tickets.