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

7 imagemagick failing doctest in plot/animate.py #28868

Closed
seblabbe opened this issue Dec 10, 2019 · 30 comments
Closed

7 imagemagick failing doctest in plot/animate.py #28868

seblabbe opened this issue Dec 10, 2019 · 30 comments

Comments

@seblabbe
Copy link
Contributor

sage -t --optional=sage,imagemagick src/sage/plot/animate.py

gives

Using --optional=imagemagick,memlimit,sage
Doctesting 1 file.
sage -t src/sage/plot/animate.py
**********************************************************************
File "src/sage/plot/animate.py", line 563, in sage.plot.animate.Animation.?
Failed example:
    with open(td + 'my_animation.gif', 'rb') as f: print('\x21\xf9\x04\x08\x23\x00' in f.read())  # optional -- ImageMagick
Exception raised:
    Traceback (most recent call last):
      File "/home/slabbe/GitBox/sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", 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/forker.py", line 1123, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.plot.animate.Animation.?[3]>", line 1, in <module>
        with open(td + 'my_animation.gif', 'rb') as f: print('\x21\xf9\x04\x08\x23\x00' in f.read())  # optional -- ImageMagick
    TypeError: a bytes-like object is required, not 'str'
**********************************************************************

...

**********************************************************************
File "src/sage/plot/animate.py", line 1068, in sage.plot.animate.Animation.save
Failed example:
    with open(td + 'wave.gif', 'rb') as f: print('!\xff\x0bNETSCAPE2.0\x03\x01\x03\x00\x00' in f.read())  # optional -- ImageMagick
Exception raised:
    Traceback (most recent call last):
      File "/home/slabbe/GitBox/sage/local/lib/python3.7/site-packages/sage/doctest/forker.py", 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/forker.py", line 1123, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.plot.animate.Animation.save[14]>", line 1, in <module>
        with open(td + 'wave.gif', 'rb') as f: print('!\xff\x0bNETSCAPE2.0\x03\x01\x03\x00\x00' in f.read())  # optional -- ImageMagick
    TypeError: a bytes-like object is required, not 'str'
**********************************************************************
2 items had failures:
   1 of   9 in sage.plot.animate.Animation.?
   6 of  16 in sage.plot.animate.Animation.save
    [208 tests, 7 failures, 57.48 s]
----------------------------------------------------------------------
sage -t src/sage/plot/animate.py  # 7 doctests failed
----------------------------------------------------------------------

Component: graphics

Author: Frédéric Chapoton

Branch/Commit: 41a0543

Reviewer: Sébastien Labbé

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

@seblabbe seblabbe added this to the sage-9.0 milestone Dec 10, 2019
@seblabbe seblabbe changed the title 1 imagemagick failing doctest in plot/animate.py 7 imagemagick failing doctest in plot/animate.py Dec 10, 2019
@fchapoton
Copy link
Contributor

Author: Frédéric Chapoton

@fchapoton
Copy link
Contributor

Branch: u/chapoton/28868

@fchapoton
Copy link
Contributor

Commit: c011c93

@fchapoton
Copy link
Contributor

New commits:

c011c93fix optional imagemagick doctests in animate

@fchapoton
Copy link
Contributor

comment:3

does not work

@embray
Copy link
Contributor

embray commented Jan 6, 2020

comment:4

Ticket retargeted after milestone closed

@embray embray modified the milestones: sage-9.0, sage-9.1 Jan 6, 2020
@fchapoton
Copy link
Contributor

comment:5

Sébastien, could you please try the branch here ? It seems that it fixes the bytes problems, but there remains a true failure afterwards.

@fchapoton
Copy link
Contributor

comment:6

All tests seem to pass, I just tried.

@seblabbe
Copy link
Contributor Author

seblabbe commented Apr 4, 2020

comment:7

With the branch on top of 9.1.beta9 I get

Git branch: 28868
Using --optional=imagemagick,memlimit,sage
Doctesting 1 file.
sage -t src/sage/plot/animate.py
**********************************************************************
File "src/sage/plot/animate.py", line 1068, in sage.plot.animate.Animation.save
Failed example:
    with open(td + 'wave.gif', 'rb') as f: print(b'!\xff\x0bNETSCAPE2.0\x03\x01\x02\x00\x00' in f.read())  # optional -- ImageMagick
Expected:
    True
Got:
    False
**********************************************************************
1 item had failures:
   1 of  16 in sage.plot.animate.Animation.save
    [208 tests, 1 failure, 57.01 s]
----------------------------------------------------------------------
sage -t src/sage/plot/animate.py  # 1 doctest failed
----------------------------------------------------------------------

@fchapoton
Copy link
Contributor

comment:8

ok. Je propose de faire passer la branche, et de garder le dernier probleme pour un autre ticket. Après tout, c'est un autre probleme, certes au meme endroit.

@seblabbe
Copy link
Contributor Author

seblabbe commented Apr 4, 2020

comment:9

J'ai identifié le soucis. Le dernier changement que tu fait remplace aussi un \x03 par un \x02:

- sage: with open(td + 'wave.gif', 'rb') as f: print('!\xff\x0bNETSCAPE2.0\x03\x01\x03\x00\x00' in f.read())  # optional -- ImageMagick
+ sage: with open(td + 'wave.gif', 'rb') as f: print(b'!\xff\x0bNETSCAPE2.0\x03\x01\x02\x00\x00' in f.read())  # optional -- ImageMagick

Si je garde le \x03, alors chez moi le test passe.

@seblabbe
Copy link
Contributor Author

seblabbe commented Apr 4, 2020

comment:10

Si chez toi, tu as besoin de garder le \x02, je suggère alors de garder que le préfixe commun
b'!\xff\x0bNETSCAPE2.0\x03\x01 pour le dernier test.

@fchapoton
Copy link
Contributor

comment:11

Chez moi, ca foire quand je mets \x03 et ca passe quand je mets \x02

Je veux bien ne garder que le prefixe commun, mais est-ce que ca ne supprime pas tout l'interet du doctest ?

@seblabbe
Copy link
Contributor Author

seblabbe commented Apr 4, 2020

comment:12

Je veux bien ne garder que le prefixe commun, mais est-ce que ca ne supprime pas tout l'interet du doctest ?

The saved file wave.gif works as expected on my machine. What about yours?

@fchapoton
Copy link
Contributor

comment:13

Il me semble que oui. Je l'attache

@fchapoton
Copy link
Contributor

Attachment: wave.gif

@fchapoton
Copy link
Contributor

comment:14

faudrait voir si il s'arrete au meme point que chez toi

@seblabbe
Copy link
Contributor Author

seblabbe commented Apr 4, 2020

comment:15

Oui, c'est pareil. Du coup, allons y avec le préfixe commun.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 5, 2020

Changed commit from c011c93 to d991581

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 5, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

2b0806eMerge branch 'u/chapoton/28868' of ssh://trac.sagemath.org:22/sage into img
d991581allow either imagemagick doctest

@fchapoton
Copy link
Contributor

comment:17

j'ai eu une autre idee : verifier la presence d'une des deux chaines. Ca me semble mieux respecter l'esprit du doctest. Voir le dernier commit

@seblabbe
Copy link
Contributor Author

seblabbe commented Apr 5, 2020

comment:18
sage -t src/sage/plot/animate.py
    [208 tests, 57.03 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------

@seblabbe
Copy link
Contributor Author

seblabbe commented Apr 5, 2020

Reviewer: Sébastien Labbé

@vbraun
Copy link
Member

vbraun commented Apr 8, 2020

comment:19
[dochtml] OSError: /amd/compute/sagebot/sage/local/lib/python3.7/site-packages/sage/plot/animate.py:docstring of sage.plot.animate.animate:11: WARNING: Duplicate explicit target name: "imagemagick".

@fchapoton
Copy link
Contributor

comment:21

oh boy, what's that ?

Could it be caused by

-- `ImageMagick <http://www.imagemagick.org>`_
+- `ImageMagick <https://www.imagemagick.org>`_

?

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 9, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

41a0543fix references in plot/animate

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 9, 2020

Changed commit from d991581 to 41a0543

@fchapoton
Copy link
Contributor

comment:23

Here is probably a fix commit. Please review.

@seblabbe
Copy link
Contributor Author

comment:24

Oups, the patchbot were telling us that problem for a while...

I think you can't have the same reference link twice in the same file. It must be because of that. I manage to build the doc correctly on my side. Patchbot light is green this time. Good to go.

@vbraun
Copy link
Member

vbraun commented Apr 16, 2020

Changed branch from u/chapoton/28868 to 41a0543

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