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

doctests: Detect "safe" external features even if "--optional=external" is not used #32174

Closed
mkoeppe opened this issue Jul 10, 2021 · 117 comments
Closed

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Jul 10, 2021

(from #30887 comment:28)

For some "safe" features such as imagemagick, rubiks, 4ti2 (#30887), pandoc, it really shouldn't require the use of external to check for these.

Likewise for the PythonModule features for Sage modules introduced in #32614. By delaying the test for these features, using the sage.doctest.external machinery, we fix the broken detection of some of these features. (This is why the ticket is marked "critical".)

This is a step toward #30746 (sage.doctest.control: Replace use of sage.misc.package.list_packages)

With this ticket, more doctests will be run by default. This may lead to new failures (discovered by patchbot for instance). But that does not mean it is introduced in this ticket, just that they were existing before this ticket, but simply not executed.

For example, let's compare the behavior of the following command:

sage -tp --show-skipped src/sage/tests/cmdline.py 

returns:

BEFORE (9.5.beta7):

Git branch: develop
Using --optional=4ti2,build,ccache,cryptominisat,debian,dochtml,dot2tex,e_antic,fricas,glucose,latte_int,lidia,normaliz,notedown,pandoc_attributes,pip,pycosat,pynormaliz,rst2ipynb,sage,sage.geometry.polyhedron,sage.rings.real_double,sage_numerical_backends_coin,sage_spkg
Doctesting 1 file using 8 threads.
sage -t --random-seed=265206128165572261397002909756599539048 src/sage/tests/cmdline.py
    3 gdb tests not run
    12 internet tests not run
    2 pandoc tests not run
    4 r tests not run
    0 tests not run because we ran out of time
    [235 tests, 30.65 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------

AFTER (9.5.beta7 + #32174):

$ sage -tp --show-skipped src/sage/tests/cmdline.py 
Git branch: 32174
Using --optional=4ti2,build,ccache,cryptominisat,debian,dochtml,dot2tex,e_antic,fricas,glucose,latte_int,lidia,normaliz,notedown,pandoc_attributes,pip,pycosat,pynormaliz,rst2ipynb,sage,sage_numerical_backends_coin,sage_spkg
Features to be detected: 4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_jones_numfield,database_knotinfo,dvipng,ffmpeg,graphviz,imagemagick,jupymake,kenzo,latte_int,lrslib,mcqd,meataxe,pandoc,pdf2svg,plantri,pynormaliz,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.plot,sage.rings.number_field,sage.rings.real_double,sage.symbolic,sage_numerical_backends_coin,tdlib
Doctesting 1 file using 8 threads.
sage -t --random-seed=100100306103974678574881156032164018710 src/sage/tests/cmdline.py
**********************************************************************
File "src/sage/tests/cmdline.py", line 732, in sage.tests.cmdline.test_executable
Failed example:
    print(open(output, 'r').read() == t)          # optional - pandoc
Expected:
    True
Got:
    False
**********************************************************************
1 item had failures:
   1 of 238 in sage.tests.cmdline.test_executable
    3 gdb tests not run
    12 internet tests not run
    4 r tests not run
    0 tests not run because we ran out of time
    [237 tests, 1 failure, 32.76 s]
----------------------------------------------------------------------
sage -t --random-seed=100100306103974678574881156032164018710 src/sage/tests/cmdline.py  # 1 doctest failed
----------------------------------------------------------------------
Features detected for doctesting: pandoc

We observe that the number of tests run went from 235 to 237, because the feature pandoc was detected. Note that the doctest failure is already tracked at #32697.

Depends on #32866
Depends on #27744

CC: @dimpase @slel @antonio-rojas @kiwifb @kwankyu @seblabbe @videlec

Component: doctest framework

Author: Matthias Koeppe, Sébastien Labbé

Branch: 41c4cd4

Reviewer: Sébastien Labbé

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

@mkoeppe mkoeppe added this to the sage-9.4 milestone Jul 10, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Jul 19, 2021
@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 7, 2021

Dependencies: #32649

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 7, 2021

Changed dependencies from #32649 to #32649, #32614

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 22, 2021

comment:5

Let's use this ticket to address the problem discovered in #32732 comment:10: Detection of Sage modules fails because the check runs before sage.all has been imported, and is therefore affected by import failures from cyclic imports

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 22, 2021

Changed dependencies from #32649, #32614 to #32732

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 8, 2021

Changed dependencies from #32732 to #32732, #32650

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 11, 2021

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 11, 2021

comment:9

Here's an approach to do feature enumeration


Last 10 new commits:

5d9414d32650: .. note -> .. NOTE
345c76032650: using features in has_latex method of doctest/external.py
6c6b33232650: independent and improved method latex().is_functional()
63555d232650: adding spkg pdf2svg in build/pkgs
c8330fe32650: linking pdf2svg feature to spkg pdf2svg
2ea4d9e32650: fixing two doctests now that we latex().require() it when we use it
98b7db6Merge #32650
0968f95sage.features.sagemath.all_features: New
cdc0cb6sage.features.all: New
c8e6c0esage.features.bliss.all_features: New

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 11, 2021

Commit: c8e6c0e

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 11, 2021

Changed commit from c8e6c0e to 69d2cfb

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 11, 2021

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

69d2cfbsrc/sage/features/kenzo.py: Move import from sage.libs.ecl into method

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 11, 2021

Author: Matthias Koeppe, ...

@slel
Copy link
Member

slel commented Nov 13, 2021

comment:12

Indent .. NOTE:: blocks 4 spaces, not 3
(can be a follow-up ticket).

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 13, 2021

Changed commit from 69d2cfb to 893ec23

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 13, 2021

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

fa45c36sage.features.sagemath.all_features: New
17e30e2sage.features.all: New
8bfebc9sage.features.bliss.all_features: New
893ec23src/sage/features/kenzo.py: Move import from sage.libs.ecl into method

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 13, 2021

Changed dependencies from #32732, #32650 to #32866

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 13, 2021

comment:14

Rebased on 9.5.beta6

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 14, 2021

Changed commit from 893ec23 to fa25155

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 14, 2021

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

eaec400src/sage/features/interfaces.py: New
827ca03src/sage/features/interfaces.py: Fix and doctest exception handling
52ac51esrc/sage/features/interfaces.py (all_features): New
7754faesrc/sage/features/interfaces.py: Fix and doctest exception handling (fixup)
8081f29src/sage/doctest/external.py: Use sage.features.interfaces
09c4238Merge #32866
c41808bsrc/sage/features/latex.py (all_features): New
44c19e3src/sage/features/mip_backends.py (all_features): New
fa25155src/sage/doctest/external.py (external_software): Go through external_features

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 14, 2021

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

945132bsrc/sage/features/interfaces.py: Fix up
f63acfdMerge #32866
7fa5b3bsrc/sage/doctest/external.py (external_features): Add CPLEX, Gurobi

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 14, 2021

Changed commit from fa25155 to 7fa5b3b

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 14, 2021

comment:17

The has_... functions are now no longer needed.

Deprecate them? Or just remove them?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 5, 2021

comment:81

that's #32697 "sage --ipynb2rst is broken due to changes in nbconvert

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 5, 2021

Changed commit from 3bfe1a1 to fdfe1a7

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 5, 2021

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

fdfe1a7src/sage/tests/cmdline.py: Mark a doctest # known bug #32697

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 5, 2021

comment:85

Thanks!

@vbraun
Copy link
Member

vbraun commented Dec 16, 2021

comment:86
**********************************************************************
File "src/sage/misc/latex.py", line 1087, in sage.misc.latex.Latex.?
Failed example:
    latex.eval(r"\ThisIsAnInvalidCommand", {}) # optional -- ImageMagick
Exception raised:
    Traceback (most recent call last):
      File "/var/lib/buildbot/slave/sage_git/build/local/var/lib/sage/venv-python3.9.9/lib/python3.9/site-packages/sage/doctest/forker.py", line 694, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/var/lib/buildbot/slave/sage_git/build/local/var/lib/sage/venv-python3.9.9/lib/python3.9/site-packages/sage/doctest/forker.py", line 1088, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.misc.latex.Latex.?[1]>", line 1, in <module>
        latex.eval(r"\ThisIsAnInvalidCommand", {}) # optional -- ImageMagick
      File "/var/lib/buildbot/slave/sage_git/build/local/var/lib/sage/venv-python3.9.9/lib/python3.9/site-packages/sage/misc/latex.py", line 1128, in eval
        e = _run_latex_(os.path.join(base, filename + ".tex"), debug=debug,
      File "/var/lib/buildbot/slave/sage_git/build/local/var/lib/sage/venv-python3.9.9/lib/python3.9/site-packages/sage/misc/latex.py", line 725, in _run_latex_
        pdflatex().require()
      File "/var/lib/buildbot/slave/sage_git/build/local/var/lib/sage/venv-python3.9.9/lib/python3.9/site-packages/sage/features/__init__.py", line 206, in require
        raise FeatureNotPresentError(self, presence.reason, presence.resolution)
    sage.features.FeatureNotPresentError: pdflatex is not available.
    Executable 'pdflatex' not found on PATH.
    Further installation instructions might be available at https://www.latex-project.org/.
**********************************************************************
1 item had failures:
   1 of   3 in sage.misc.latex.Latex.?
    [250 tests, 1 failure, 0.35 s]
    Timed out
**********************************************************************

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 17, 2021

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

8f5c962Merge tag '9.5.beta8' into t/32174/public/32174
41c4cd4src/sage/misc/latex.py: Add another # optional - latex

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 17, 2021

Changed commit from fdfe1a7 to 41c4cd4

@vbraun
Copy link
Member

vbraun commented Dec 19, 2021

Changed branch from public/32174 to 41c4cd4

@vbraun
Copy link
Member

vbraun commented Dec 19, 2021

Changed commit from 41c4cd4 to none

@vbraun
Copy link
Member

vbraun commented Dec 19, 2021

comment:90

Followup at #33045 for ffmpeg

@slel
Copy link
Member

slel commented Jan 1, 2022

comment:91

Followup at #33101 for lrslib.

@slel
Copy link
Member

slel commented Jan 1, 2022

comment:92

See also #33092 for ffmpeg and imagemagick.

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

5 participants