Opened 3 years ago

Closed 3 years ago

#28867 closed defect (fixed)

1 imagemagick failing doctest in misc/

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

Status badges


sage -t --optional=sage,imagemagick src/sage/misc/


Using --optional=imagemagick,memlimit,sage
Doctesting 1 file.
sage -t src/sage/misc/
File "src/sage/misc/", line 1086, in sage.misc.latex.Latex.?
Failed example:
    latex.eval("\ThisIsAnInvalidCommand", {}) # optional -- ImageMagick
Exception raised:
    Traceback (most recent call last):
      File "/home/slabbe/GitBox/sage/local/lib/python3.7/site-packages/sage/doctest/", line 681, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/slabbe/GitBox/sage/local/lib/python3.7/site-packages/sage/doctest/", line 1123, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.misc.latex.Latex.?[1]>", line 1, in <module>
        latex.eval("\ThisIsAnInvalidCommand", {}) # optional -- ImageMagick
      File "/home/slabbe/GitBox/sage/local/lib/python3.7/site-packages/sage/misc/", line 1115, in eval
        O.write(str_to_bytes(x, encoding='utf-8'))
    TypeError: write() argument must be str, not bytes
1 item had failures:
   1 of   3 in sage.misc.latex.Latex.?
    [303 tests, 1 failure, 0.93 s]
sage -t src/sage/misc/  # 1 doctest failed

Change History (5)

comment:1 Changed 3 years ago by Erik Bray

Milestone: sage-9.0sage-9.1

Ticket retargeted after milestone closed

comment:2 Changed 3 years ago by Sébastien Labbé

Cc: Frédéric Chapoton added

Fredéric, I think you solved something similar in the past. Do you see easily a fix?

comment:3 Changed 3 years ago by Frédéric Chapoton

Authors: Frédéric Chapoton
Branch: u/chapoton/28867
Commit: c2c24c41d2cebc36aa3239030b0a802ba1c3d039
Status: newneeds_review

Voilà. Y a de grandes chances que ca casse les doctests sous python2. A mon avis, y a pas moyen d'avoir les deux. Et c'est un doctest optionnel..

New commits:

c2c24c4trac 28867 py3 fix for latex

comment:4 Changed 3 years ago by Sébastien Labbé

Reviewers: Sébastien Labbé
Status: needs_reviewpositive_review

I confirm it fixes the issue for that optional doctest (9.1.beta2 running Python 3).

comment:5 Changed 3 years ago by Volker Braun

Branch: u/chapoton/28867c2c24c41d2cebc36aa3239030b0a802ba1c3d039
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.