cschwan / sage-on-gentoo

(Unofficial) Gentoo Overlay for Sage- and Sage-related ebuilds
84 stars 26 forks source link

odd doctest failure in lazy_import.pyx (9.3.beta4) #614

Closed strogdon closed 3 years ago

strogdon commented 3 years ago

I have this somewhat odd doctest failure

sage -t --long --random-seed=0 /usr/lib/python3.8/site-packages/sage/misc/lazy_import.pyx
**********************************************************************
File "/usr/lib/python3.8/site-packages/sage/misc/lazy_import.pyx", line 1073, in sage.misc.lazy_import.?
Failed example:
    not_there
Expected:
    Failed lazy import:
    foo is not available.
    Importing not_there failed: No module named 'foo'...
    No equivalent system packages for ... are known to Sage...
Got:
    Failed lazy import:
    foo is not available.
    Importing not_there failed: No module named 'foo'
**********************************************************************

It seems cosmetic but what is the source?

kiwifb commented 3 years ago

This is strange I don't get that failure. I cannot think of what would truncate the output like this.

strogdon commented 3 years ago

I have it on both gentoo and prefix. The indicated files were touched at https://trac.sagemath.org/ticket/30587

kiwifb commented 3 years ago

Can you try it like this

fbissey@moonloop ~ $ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.3.beta3, Release Date: 2020-12-06               │
│ Using Python 3.8.6. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: from sage.features import PythonModule
sage: lazy_import('foo', 'not_there', feature=PythonModule('foo', spkg='non-existing-package'))
sage: not_there
Failed lazy import:
foo is not available.
Importing not_there failed: No module named 'foo'
No equivalent system packages for pip are known to Sage.

and see what it says? While my sage says 9.3.beta3, the only commit missing from beta4 is the version number change.

strogdon commented 3 years ago
steven@hp-envy ~ $ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.3.beta4, Release Date: 2020-12-14               │
│ Using Python 3.8.6. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: from sage.features import PythonModule
sage: lazy_import('foo', 'not_there', feature=PythonModule('foo', spkg='non-existing-package'))
sage: not_there
Failed lazy import:
foo is not available.
Importing not_there failed: No module named 'foo'

I bet it's because I do not have pip installed.

kiwifb commented 3 years ago

That sounds like a good explanation.

strogdon commented 3 years ago

That was it. I don't need pip. There is one other doctest that fails if pip is not installed.