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

With plantri installed, a doctest creates a file in SAGE_ROOT #34245

Closed
jhpalmieri opened this issue Jul 29, 2022 · 9 comments
Closed

With plantri installed, a doctest creates a file in SAGE_ROOT #34245

jhpalmieri opened this issue Jul 29, 2022 · 9 comments

Comments

@jhpalmieri
Copy link
Member

The doctest in graphs/graph_generators.py

            sage: list(graphs.plantri_gen("6 -c 3"))  # optional plantri
            Traceback (most recent call last):
            ...
            AttributeError: invalid options '6 -c 3'

creates a file "3" in SAGE_ROOT if the optional package plantri is detected and used. Maybe the doctest should be changed, maybe the code should be changed so that the error is caught before the file is created.

Component: packages: optional

Author: Dave Morris

Branch/Commit: 4b3b7f4

Reviewer: David Coudert

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

@DaveWitteMorris
Copy link
Member

Branch: public/34245

@DaveWitteMorris
Copy link
Member

Commit: 4b3b7f4

@DaveWitteMorris
Copy link
Member

comment:2

Good catch! (Plantri parses "3" as the name of the output file.) This little patch fixes the doctest so it tests the same sagemath codepath without creating a file.


New commits:

4b3b7f4trac 34245 doctest shouldn't create file

@DaveWitteMorris
Copy link
Member

Author: Dave Morris

@dcoudert
Copy link
Contributor

comment:3

Thank you for the fix.

@dcoudert
Copy link
Contributor

Reviewer: David Coudert

@dcoudert
Copy link
Contributor

comment:4

FYI, plantri writes to stderr:

  • when options='6 -c3'
['/Users/dcoudert/sage/local/bin/plantri 6 -c3 \n',
 '2 triangulations written to stdout; cpu=0.00 sec\n']
  • when options='6 -c=3'
['/Users/dcoudert/sage/local/bin/plantri 6 -c=3 \n',
 '>E /Users/dcoudert/sage/local/bin/plantri:  -= is not permitted\n']
  • when options='6 -c 3'
['/Users/dcoudert/sage/local/bin/plantri 6 -c 3 \n',
 '2 triangulations written to 3; cpu=0.02 sec\n']

In this last case, the graphs are written in file 3 and this is not an error. Consequently, some users may write output to file without noticing it and I don't know how to prevent that. We may however raise a warning since we can detect that stdout is missing.

@DaveWitteMorris
Copy link
Member

comment:5

Thanks for the review and additional comments. Perhaps there should be a follow-up ticket.

@vbraun
Copy link
Member

vbraun commented Aug 4, 2022

Changed branch from public/34245 to 4b3b7f4

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