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 failures in sage/doctest/control.py when sagemath-meataxe is installed #37905

Closed
2 tasks done
kiwifb opened this issue Apr 30, 2024 · 4 comments · Fixed by #37737
Closed
2 tasks done

Doctests failures in sage/doctest/control.py when sagemath-meataxe is installed #37905

kiwifb opened this issue Apr 30, 2024 · 4 comments · Fixed by #37737

Comments

@kiwifb
Copy link
Member

kiwifb commented Apr 30, 2024

Steps To Reproduce

This is observed in sage-on-gentoo with both python 3.11 and python 3.12 and sage 10.4.beta4. Install sagemath-meataxe and run

sage -t --long /usr/lib/python3.11/site-packages/sage/doctest/control.py

Expected Behavior

When sagemath-meataxe is not installed, the doctest pass

sage -t --long --random-seed=309974202432976880116456820555380509718 /usr/lib/python3.11/site-packages/sage/doctest/control.py
    [229 tests, 1.46 s]
----------------------------------------------------------------------
All tests passed!
----------------------------------------------------------------------

Actual Behavior

The doctest fails with

sage -t --long --random-seed=170181526529337143612090850685532611974 /usr/lib/python3.11/site-packages/sage/doctest/control.py
**********************************************************************
File "/usr/lib/python3.11/site-packages/sage/doctest/control.py", line 1447, in sage.doctest.control.DocTestController.run
Failed example:
    DC.run()
Expected:
    Running doctests with ID ...
    Using --optional=sage...
    Features to be detected: ...
    Doctesting 1 file.
    sage -t ....py
        [4 tests, ... s]
    ----------------------------------------------------------------------
    All tests passed!
    ----------------------------------------------------------------------
    Total time for all tests: ... seconds
        cpu time: ... seconds
        cumulative wall time: ... seconds
    Features detected...
    0
Got:
    Running doctests with ID 2024-04-30-13-53-30-5803c5d0.
    Running with SAGE_LOCAL='/usr' and SAGE_VENV='/usr'
    Using --optional=sage
    Features to be detected: 4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,cvxopt,cvxopt,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_cubic_hecke,database_ellcurves,database_graphs,database_jones_numfield,database_knotinfo,dvipng,ecm,fpylll,fricas,gap_package_atlasrep,gap_package_design,gap_package_grape,gap_package_guava,gap_package_hap,gap_package_polycyclic,gap_package_qpa,gap_package_quagroup,gfan,graphviz,imagemagick,ipython,jmol,jupymake,kenzo,latte_int,lrcalc_python,lrslib,matroid_database,mcqd,meataxe,mpmath,msolve,nauty,networkx,numpy,palp,pandoc,pdf2svg,pdftocairo,pexpect,phitigra,pillow,plantri,polytopes_db,polytopes_db_4d,pplpy,primecountpy,ptyprocess,pynormaliz,pyparsing,python_igraph,requests,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.libs.braiding,sage.libs.ecl,sage.libs.flint,sage.libs.gap,sage.libs.linbox,sage.libs.m4ri,sage.libs.ntl,sage.libs.pari,sage.libs.singular,sage.misc.cython,sage.modular,sage.modules,sage.numerical.mip,sage.plot,sage.rings.complex_double,sage.rings.finite_rings,sage.rings.function_field,sage.rings.number_field,sage.rings.padics,sage.rings.polynomial.pbori,sage.rings.real_double,sage.rings.real_mpfr,sage.sat,sage.schemes,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,scipy,singular,sphinx,symengine_py,sympy,tdlib,threejs
    Doctesting 1 file.
    sage -t --random-seed=0 /tmp/tmp3o72lmtj/tmp_qd1plq6l.py
        [5 tests, 0.12 s]
    ----------------------------------------------------------------------
    All tests passed!
    ----------------------------------------------------------------------
    Total time for all tests: 0.1 seconds
        cpu time: 0.1 seconds
        cumulative wall time: 0.1 seconds
    Features detected for doctesting: meataxe,sage.libs.singular,sage.modules,sage.rings.finite_rings,sage.rings.number_field,sage.rings.real_mpfr,sage.symbolic,sympy
    Features that have been hidden: meataxe
    0
**********************************************************************
File "/usr/lib/python3.11/site-packages/sage/doctest/control.py", line 1465, in sage.doctest.control.DocTestController.run
Failed example:
    DC.run()
Expected:
    Running doctests with ID ...
    Using --optional=sage
    Features to be detected: ...
    Doctesting 1 file.
    sage -t ....py
        [4 tests, ... s]
    ----------------------------------------------------------------------
    All tests passed!
    ----------------------------------------------------------------------
    Total time for all tests: ... seconds
        cpu time: ... seconds
        cumulative wall time: ... seconds
    Features detected...
    0
Got:
    Running doctests with ID 2024-04-30-13-53-30-601ce747.
    Running with SAGE_LOCAL='/usr' and SAGE_VENV='/usr'
    Using --optional=sage
    Features to be detected: 4ti2,bliss,conway_polynomials,csdp,cvxopt,cvxopt,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_cubic_hecke,database_ellcurves,database_graphs,database_jones_numfield,database_knotinfo,dvipng,ecm,fpylll,fricas,gap_package_atlasrep,gap_package_design,gap_package_grape,gap_package_guava,gap_package_hap,gap_package_polycyclic,gap_package_qpa,gap_package_quagroup,gfan,graphviz,imagemagick,ipython,jmol,jupymake,kenzo,latte_int,lrcalc_python,lrslib,matroid_database,mcqd,meataxe,mpmath,msolve,nauty,networkx,numpy,palp,pandoc,pdf2svg,pdftocairo,pexpect,phitigra,pillow,plantri,polytopes_db,polytopes_db_4d,pplpy,primecountpy,ptyprocess,pynormaliz,pyparsing,python_igraph,requests,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.libs.braiding,sage.libs.ecl,sage.libs.flint,sage.libs.gap,sage.libs.linbox,sage.libs.m4ri,sage.libs.ntl,sage.libs.pari,sage.libs.singular,sage.misc.cython,sage.modular,sage.modules,sage.numerical.mip,sage.plot,sage.rings.complex_double,sage.rings.finite_rings,sage.rings.function_field,sage.rings.number_field,sage.rings.padics,sage.rings.polynomial.pbori,sage.rings.real_double,sage.rings.real_mpfr,sage.sat,sage.schemes,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,scipy,singular,sphinx,symengine_py,sympy,tdlib,threejs
    Doctesting 1 file.
    sage -t --random-seed=0 /tmp/tmp3o72lmtj/tmp_qd1plq6l.py
        [5 tests, 0.14 s]
    ----------------------------------------------------------------------
    All tests passed!
    ----------------------------------------------------------------------
    Total time for all tests: 0.2 seconds
        cpu time: 0.1 seconds
        cumulative wall time: 0.1 seconds
    Features detected for doctesting: meataxe,sage.libs.singular,sage.modules,sage.rings.finite_rings,sage.rings.number_field,sage.rings.real_mpfr,sage.symbolic,sympy
    Features that have been hidden: meataxe
    0
**********************************************************************
File "/usr/lib/python3.11/site-packages/sage/doctest/control.py", line 1483, in sage.doctest.control.DocTestController.run
Failed example:
    DC.run()                              # optional - meataxe
Expected:
    Running doctests with ID ...
    Using --optional=sage
    Features to be detected: ...
    Doctesting 1 file.
    sage -t ....py
        [4 tests, ... s]
    ----------------------------------------------------------------------
    All tests passed!
    ----------------------------------------------------------------------
    Total time for all tests: ... seconds
        cpu time: ... seconds
        cumulative wall time: ... seconds
    Features detected...
    Features that have been hidden: ...meataxe...
    0
Got:
    Running doctests with ID 2024-04-30-13-53-30-a0fa6d56.
    Running with SAGE_LOCAL='/usr' and SAGE_VENV='/usr'
    Using --optional=sage
    Features to be detected: 4ti2,bliss,conway_polynomials,csdp,cvxopt,cvxopt,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_cubic_hecke,database_ellcurves,database_graphs,database_jones_numfield,database_knotinfo,dvipng,ecm,fpylll,fricas,gap_package_atlasrep,gap_package_design,gap_package_grape,gap_package_guava,gap_package_hap,gap_package_polycyclic,gap_package_qpa,gap_package_quagroup,gfan,graphviz,imagemagick,ipython,jmol,jupymake,kenzo,latte_int,lrcalc_python,lrslib,matroid_database,mcqd,meataxe,mpmath,msolve,nauty,networkx,numpy,palp,pandoc,pdf2svg,pdftocairo,pexpect,phitigra,pillow,plantri,polytopes_db,polytopes_db_4d,pplpy,primecountpy,ptyprocess,pynormaliz,pyparsing,python_igraph,requests,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.libs.braiding,sage.libs.ecl,sage.libs.flint,sage.libs.gap,sage.libs.linbox,sage.libs.m4ri,sage.libs.ntl,sage.libs.pari,sage.libs.singular,sage.misc.cython,sage.modular,sage.modules,sage.numerical.mip,sage.plot,sage.rings.complex_double,sage.rings.finite_rings,sage.rings.function_field,sage.rings.number_field,sage.rings.padics,sage.rings.polynomial.pbori,sage.rings.real_double,sage.rings.real_mpfr,sage.sat,sage.schemes,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,scipy,singular,sphinx,symengine_py,sympy,tdlib,threejs
    Doctesting 1 file.
    sage -t --random-seed=0 /tmp/tmp3o72lmtj/tmp_qd1plq6l.py
        [5 tests, 0.12 s]
    ----------------------------------------------------------------------
    All tests passed!
    ----------------------------------------------------------------------
    Total time for all tests: 0.1 seconds
        cpu time: 0.1 seconds
        cumulative wall time: 0.1 seconds
    Features detected for doctesting: meataxe,sage.libs.singular,sage.modules,sage.rings.finite_rings,sage.rings.number_field,sage.rings.real_mpfr,sage.symbolic,sympy
    Features that have been hidden: meataxe
    0
**********************************************************************
1 item had failures:
   3 of  23 in sage.doctest.control.DocTestController.run
    [230 tests, 3 failures, 1.64 s]
----------------------------------------------------------------------
sage -t --long --random-seed=170181526529337143612090850685532611974 /usr/lib/python3.11/site-packages/sage/doctest/control.py  # 3 doctests failed

Additional Information

As can be seen in the failing doctest there is a mention that meataxe is a hidden feature. But in actual fact it is not during this test.

Environment

- Gentoo
- 10.4.beta4 (sage-on-gentoo)

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide
@kiwifb kiwifb added the t: bug label Apr 30, 2024
@kiwifb
Copy link
Member Author

kiwifb commented Apr 30, 2024

Actually it is most likely a self inflicted sage-on-gentoo feature because I avoid using stuff from misc/package.py in doctest as much as possible. But if we are going to deal with that unfortunate old sage feature we need to remember about this.

This test failure also only appeared recently.

@kiwifb
Copy link
Member Author

kiwifb commented Apr 30, 2024

On closer inspection, I am not sure how meataxe is supposed to be masked in that doctest. I cannot work it out.

@mkoeppe
Copy link
Contributor

mkoeppe commented Apr 30, 2024

@kiwifb See #37857 for some of the necessary changes; but also there is an open question.

@soehms
Copy link
Member

soehms commented May 9, 2024

The issue will be fixed by #37737, especially commit f881e2b (see also #37737 (comment)).

vbraun pushed a commit to vbraun/sage that referenced this issue May 11, 2024
    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

From sagemath#36741 (comment)

> Overall, I would suggest to remove the direct and unconditional use of
multiprocessing from sage.features.
> Perhaps sage.doctest can put such Value attributes into features that
are to be hidden.

This PR implements the suggestion made in
sagemath#36741 (comment)

> I looked a little bit into it and here's an idea:
>
> * In features, implement a simple hide() / unhide() / is_hidden()
interface.
> * The only state is _hidden, not shared (for parallel doctesting this
will be set before fork so it's ok)
> * Implement AvailableSoftware.hidden() similar to
AvailableSoftware.seen() so the logic stays in that class and internals
don't leak to sage.doctest.control (if necessary use _seen[idx] to
record hidden state and/or number of hidings, or add another shared
array)

Fixes sagemath#37905


### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [ ] The title is concise and informative.
- [ ] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#37737
Reported by: Sebastian Oehms
Reviewer(s): Matthias Köppe, Sebastian Oehms
vbraun pushed a commit to vbraun/sage that referenced this issue May 12, 2024
    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

From sagemath#36741 (comment)

> Overall, I would suggest to remove the direct and unconditional use of
multiprocessing from sage.features.
> Perhaps sage.doctest can put such Value attributes into features that
are to be hidden.

This PR implements the suggestion made in
sagemath#36741 (comment)

> I looked a little bit into it and here's an idea:
>
> * In features, implement a simple hide() / unhide() / is_hidden()
interface.
> * The only state is _hidden, not shared (for parallel doctesting this
will be set before fork so it's ok)
> * Implement AvailableSoftware.hidden() similar to
AvailableSoftware.seen() so the logic stays in that class and internals
don't leak to sage.doctest.control (if necessary use _seen[idx] to
record hidden state and/or number of hidings, or add another shared
array)

Fixes sagemath#37905


### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [ ] The title is concise and informative.
- [ ] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#37737
Reported by: Sebastian Oehms
Reviewer(s): Matthias Köppe, Sebastian Oehms
@vbraun vbraun closed this as completed in 7ace60e May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants