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

Fix IP is none error in doctests #30935

Closed
tobiasdiez opened this issue Nov 18, 2020 · 6 comments
Closed

Fix IP is none error in doctests #30935

tobiasdiez opened this issue Nov 18, 2020 · 6 comments

Comments

@tobiasdiez
Copy link
Contributor

The sage doctester, when invoked from plain Python, errors out because IPython is not initialized:

./sage -python -c 'import sage.all; import sage.doctest.control; sage.doctest.control.run_doctests(sage)'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-algebraic-2018-spring/local/lib/python3.7/site-packages/sage/doctest/control.py", line 1305, in run_doctests
    old_color = IP.colors
AttributeError: 'NoneType' object has no attribute 'colors'

This is fixed by adding a check for none.

CC: @mkoeppe @dimpase

Component: doctest framework

Author: Tobias Diez

Branch/Commit: 042825b

Reviewer: Matthias Koeppe

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

@mkoeppe
Copy link
Contributor

mkoeppe commented Nov 23, 2020

comment:2

Could you expand the ticket description please? How does one provoke this error?

@tobiasdiez
Copy link
Contributor Author

comment:3

The error happened while running

import sage.all
import sage.doctest.control
sage.doctest.control.run_doctests(sage)

via the VS Code "Run Python file in terminal". (I know that is a somewhat none-standard form to run the doctests.) Stack trace:

Traceback (most recent call last):
  File "/mnt/d/Programming/Projects/sage/src/test_docs.py", line 3, in <module>
    sage.doctest.control.run_doctests(sage)
  File "/mnt/d/Programming/Projects/sage/src/sage/doctest/control.py", line 1305, in run_doctests
    old_color = IP.colors
AttributeError: 'NoneType' object has no attribute 'colors'

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor

mkoeppe commented Nov 24, 2020

Reviewer: Matthias Koeppe

@tobiasdiez
Copy link
Contributor Author

comment:6

Thanks!

@vbraun
Copy link
Member

vbraun commented Dec 5, 2020

Changed branch from public/doctest/ipythonnot to 042825b

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