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

doctest failure when doc html not built/installed but sphinx is available in PYTHONPATH #33585

Closed
tornaria opened this issue Mar 28, 2022 · 7 comments

Comments

@tornaria
Copy link
Contributor

Tested on 9.6.beta6:

sage -t --warn-long 59.1 --random-seed=105547399700723726081010659407775307910 src/sage/misc/sagedoc.py
**********************************************************************
File "src/sage/misc/sagedoc.py", line 1404, in sage.misc.sagedoc._sage_doc.__call__
Failed example:
    browse_sage_doc(identity_matrix, 'html', False)             # optional - sphinx
Exception raised:
    Traceback (most recent call last):
      File "/opt/sage/sage-git/develop/pkgs/sagemath-standard/build/lib.linux-x86_64-3.10/sage/doctest/forker.py", line 695, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/opt/sage/sage-git/develop/pkgs/sagemath-standard/build/lib.linux-x86_64-3.10/sage/doctest/forker.py", line 1093, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.misc.sagedoc._sage_doc.__call__[2]>", line 1, in <module>
        browse_sage_doc(identity_matrix, 'html', False)             # optional - sphinx
      File "sage/misc/lazy_import.pyx", line 391, in sage.misc.lazy_import.LazyImport.__call__ (build/cythonized/sage/misc/lazy_import.c:4256)
        return self.get_object()(*args, **kwds)
      File "/opt/sage/sage-git/develop/pkgs/sagemath-standard/build/lib.linux-x86_64-3.10/sage/misc/sagedoc.py", line 1450, in __call__
        html = sphinxify(s)
      File "/opt/sage/sage-git/develop/pkgs/sagemath-standard/build/lib.linux-x86_64-3.10/sage/misc/sphinxify.py", line 122, in sphinxify
        sphinx_app = Sphinx(srcdir, confdir, outdir, doctreedir, format,
      File "/usr/lib/python3.10/site-packages/sphinx/application.py", line 263, in __init__
        self._init_builder()
      File "/usr/lib/python3.10/site-packages/sphinx/application.py", line 321, in _init_builder
        self.builder.init()
      File "/usr/lib/python3.10/site-packages/sphinx/builders/html/__init__.py", line 220, in init
        self.init_templates()
      File "/usr/lib/python3.10/site-packages/sphinx/builders/html/__init__.py", line 268, in init_templates
        self.theme = theme_factory.create(themename)
      File "/usr/lib/python3.10/site-packages/sphinx/theming.py", line 249, in create
        raise ThemeError(__('no theme named %r found (missing theme.conf?)') % name)
    sphinx.errors.ThemeError: no theme named 'sage-classic' found (missing theme.conf?)
**********************************************************************
1 item had failures:
   1 of   6 in sage.misc.sagedoc._sage_doc.__call__
    [100 tests, 1 failure, 20.72 s]

Indeed, this is not new, but I didn't have sphinx installed before.

It seems to me that the following patch should fix this:

--- a/src/sage/misc/sagedoc.py
+++ b/src/sage/misc/sagedoc.py
@@ -1401,7 +1401,7 @@ class _sage_doc:
             "...**File:**...**Type:**...**Definition:** identity_matrix..."
             sage: identity_matrix.__doc__ in browse_sage_doc(identity_matrix, 'rst')
             True
-            sage: browse_sage_doc(identity_matrix, 'html', False)             # optional - sphinx
+            sage: browse_sage_doc(identity_matrix, 'html', False)             # optional - sphinx sagemath_doc_html
             '...div...File:...Type:...Definition:...identity_matrix...'
 
         In the 'text' version, double colons have been replaced with

Component: doctest framework

Author: Gonzalo Tornaría

Branch/Commit: a04a0a0

Reviewer: Matthias Koeppe

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

@tornaria
Copy link
Contributor Author

New commits:

a04a0a0Trac #33585: fix doctest when dochtml is missing...

@tornaria
Copy link
Contributor Author

Author: Gonzalo Tornaría

@tornaria
Copy link
Contributor Author

Commit: a04a0a0

@tornaria
Copy link
Contributor Author

Branch: u/tornaria/33585

@mkoeppe
Copy link
Contributor

mkoeppe commented Mar 29, 2022

comment:2

LGTM.

@mkoeppe
Copy link
Contributor

mkoeppe commented Mar 29, 2022

Reviewer: Matthias Koeppe

@vbraun
Copy link
Member

vbraun commented Apr 2, 2022

Changed branch from u/tornaria/33585 to a04a0a0

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