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

sage -t --show-skipped says "5 latex tests not run" while they are #25308

Closed
seblabbe opened this issue May 8, 2018 · 19 comments
Closed

sage -t --show-skipped says "5 latex tests not run" while they are #25308

seblabbe opened this issue May 8, 2018 · 19 comments

Comments

@seblabbe
Copy link
Contributor

seblabbe commented May 8, 2018

First I add a problem in the output of a #optional - latex doctest:

diff --git a/src/sage/misc/latex.py b/src/sage/misc/latex.py
index 4771a1c..01e9cb4 100644
--- a/src/sage/misc/latex.py
+++ b/src/sage/misc/latex.py
@@ -1548,7 +1548,7 @@ Warning: `{}` is not part of this computer's TeX installation.""".format(file_na
             sage: latex.add_package_to_preamble_if_available("xypic")
             sage: latex.add_package_to_preamble_if_available("nonexistent_package")
             sage: latex.extra_preamble()       # optional - latex
-            '\\usepackage{xypic}\n'
+            '\\usepackage{xypic}\n' PROBLEM
             sage: latex.extra_preamble('')
         """
         assert isinstance(package_name, str)

Then this is OK:

$ sage -t --show-skipped src/sage/misc/latex.py
Using --optional=ccache,dot2tex,mpir,notedown,pandoc_attributes,python2,rst2ipynb,sage
Doctesting 1 file.
sage -t src/sage/misc/latex.py
    1 imagemagick test not run
    5 latex tests not run
    3 other tests skipped
    [310 tests, 1.23 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------

Then, writing --optional=sage,external detects that latex is available and runs the 5 latex optional tests (total number of tests goes from 310 to 315).

$ sage -t --show-skipped --optional=sage,external src/sage/misc/latex.py
Using --optional=external,sage
External software to be detected: cplex,gurobi,internet,latex,macaulay2,magma,maple,mathematica,matlab,octave,scilab
Doctesting 1 file.
sage -t src/sage/misc/latex.py
**********************************************************************
File "src/sage/misc/latex.py", line 1550, in sage.misc.latex.Latex.add_package_to_preamble_if_available
Failed example:
    latex.extra_preamble()       # optional - latex
Expected:
    '\\usepackage{xypic}\n' PROBLEM
Got:
    '\\usepackage{xypic}\n'
**********************************************************************
1 item had failures:
   1 of   5 in sage.misc.latex.Latex.add_package_to_preamble_if_available
    1 imagemagick test not run
    5 latex tests not run
    3 other tests skipped
    [315 tests, 1 failure, 1.55 s]
----------------------------------------------------------------------
sage -t src/sage/misc/latex.py  # 1 doctest failed
----------------------------------------------------------------------
Total time for all tests: 1.8 seconds
    cpu time: 0.6 seconds
    cumulative wall time: 1.5 seconds
External software detected for doctesting: latex

But --show-skipped still says that 5 latex tests not run.

Component: doctest framework

Author: Sébastien Labbé

Branch/Commit: 8993459

Reviewer: Vincent Klein

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

@seblabbe seblabbe added this to the sage-8.3 milestone May 8, 2018
@seblabbe
Copy link
Contributor Author

seblabbe commented May 8, 2018

Commit: 4049930

@seblabbe
Copy link
Contributor Author

seblabbe commented May 8, 2018

Author: Sébastien Labbé

@seblabbe
Copy link
Contributor Author

seblabbe commented May 8, 2018

Branch: u/slabbe/25308

@seblabbe
Copy link
Contributor Author

seblabbe commented May 8, 2018

New commits:

404993025308: fix --show-skipped for external softwares

@seblabbe

This comment has been minimized.

@jdemeyer
Copy link

jdemeyer commented May 8, 2018

comment:3

While this probably solves the problem, I wonder if we could just update self.controller.options.optional or have some API to return the optional tags.

@seblabbe
Copy link
Contributor Author

seblabbe commented May 8, 2018

comment:4

The header of the external.py says that the detection of external software is done lazily:

"""
Detecting external software

This module makes up a list of external software that Sage interfaces. Availability
of each software is tested only when necessary. This is mainly used for the doctests
which require certain external software installed on the system.

...

class AvailableSoftware(object):
    """
    This class keeps the set of available software whose availability is detected lazily
    from the list of external software.

...

So what you mean is to update self.controller.options.optional every time an external software is detected?

@jdemeyer
Copy link

jdemeyer commented May 9, 2018

comment:5

To be honest, I don't know exactly what I mean. I was more thinking of abstracting this check in a method like

def have_optional_tag(self, tag):
    if tag in self.controller.options.optional:
        return True
    if 'external' in self.controller.options.optional:
        if tag in available_software.seen():
            return True
    return False

and then using that.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 10, 2018

Changed commit from 4049930 to 5d6bb67

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 10, 2018

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

1bb26ff25308: fix --show-skipped for external softwares
5d6bb6725308: adding method have_optional_tag

@seblabbe
Copy link
Contributor Author

comment:7

Good idea. I added such a method. And I rebased the branch on top on 8.3.beta0 to avoid merge commits.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 10, 2018

Changed commit from 5d6bb67 to 8993459

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented May 10, 2018

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

899345925308: adding method have_optional_tag

@seblabbe
Copy link
Contributor Author

comment:9

Improved doc. Re-needs review.

@seblabbe
Copy link
Contributor Author

comment:10

ping

@vinklein
Copy link
Mannequin

vinklein mannequin commented Jun 20, 2018

comment:11

Tested. It's fine for me.

@seblabbe
Copy link
Contributor Author

Reviewer: Vincent Klein

@seblabbe
Copy link
Contributor Author

comment:13

Thanks for the review.

@vbraun
Copy link
Member

vbraun commented Jun 21, 2018

Changed branch from u/slabbe/25308 to 8993459

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

3 participants