-
-
Notifications
You must be signed in to change notification settings - Fork 656
Description
As suggested in #33823 (see comment 25) I make a first attempt for such an option here. The purpose of the option is to find test which need to be marked as optional
but aren't right now.
For example see the test of the following file which contains two tests involving the optional package database_knotinfo
. Note that on the system where I produced the output below this feature is available.
cat test_knotinfo.py
r"""
sage: KnotInfo.K9_10.homfly_polynomial()
-v^10*z^2 + v^8*z^4 - 2*v^10 + 2*v^8*z^2 + 2*v^6*z^4 + v^8 + 5*v^6*z^2 + v^4*z^4 + 2*v^6 + 2*v^4*z^2
sage: KnotInfo.K9_10.alexander_polynomial() # optional database_knotinfo
4*t^4 - 8*t^3 + 9*t^2 - 8*t + 4
"""
The first test is missing the optional
tag. Thus, this would fail on a system without that feature. But, running sage -t
without the new option does not show the problem:
sage -t test_knotinfo.py
too many failed tests, not using stored timings
Running doctests with ID ...
...
Git ref: 9.7.beta5-...
...
Using --optional=database_knotinfo,debian,debugpy,mathics,mathics_scanner,palettable,pint,pip,sage,sage_spkg
Features to be detected: ...
Doctesting 1 file.
sage -t --random-seed=17350038375103993251556014960108337039 test_knotinfo.py
[2 tests, 4.66 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------
Total time for all tests: 4.7 seconds
cpu time: 4.7 seconds
cumulative wall time: 4.7 seconds
Features detected for doctesting:
Using the new option this will be the case:
sage -t --hide=database_knotinfo test_knotinfo.py
too many failed tests, not using stored timings
Running doctests with ...
...
Git ref: 9.7.beta5-...
...
Using --optional=debian,debugpy,mathics,mathics_scanner,palettable,pint,pip,sage,sage_spkg
Features to be detected: ...
Hidden features: database_knotinfo
Doctesting 1 file.
sage -t --random-seed=109756173219998976577146490280531589198 test_knotinfo.py
**********************************************************************
File "test_knotinfo.py", line 2, in test_knotinfo
Failed example:
KnotInfo.K9_10.homfly_polynomial()
Exception raised:
Traceback (most recent call last):
...
NameError: name 'KnotInfo' is not defined
**********************************************************************
1 item had failures:
1 of 2 in test_knotinfo
[1 test, 1 failure, 0.00 s]
----------------------------------------------------------------------
sage -t --random-seed=109756173219998976577146490280531589198 test_knotinfo.py # 1 doctest failed
----------------------------------------------------------------------
Total time for all tests: 0.0 seconds
cpu time: 0.0 seconds
cumulative wall time: 0.0 seconds
Features detected for doctesting:
Depends on #34282
Depends on #34283
CC: @seblabbe
Component: doctest framework
Author: Sebastian Oehms
Branch/Commit: u/soehms/hide_features_34185 @ 2a582f4
Issue created by migration from https://trac.sagemath.org/ticket/34185