Fix a couple of doctests that trigger when building from sdist#37645
Fix a couple of doctests that trigger when building from sdist#37645tornaria wants to merge 2 commits intosagemath:developfrom
Conversation
This triggers when one installs `sagemath-standard` from the sdist, which is missing `tdlib.pyx`; the issue is hidden when installing from the source tree since then `tdlib.pyx` is installed with `sagemath-standard`, in spite of it being in `sagemath-tdlib`.
This triggers when one is running sagemath not from site-packages (via PYTHONPATH). In this case, the lines like ``` File "tolerance.rst", line ..., in sage.doctest.tests.tolerance ``` are instead printed as ``` File "tolerance.rst", line 6, in tolerance` ```
I think we can find a better fix for this, let me take a look. This may be the same issue as with all the PEP-420 issues -- finding the root is not well-defined. (But it's well-defined in the Sage layout because of our all*.py files.) |
|
Indeed this is happening in |
|
Documentation preview for this PR (built with commit 1f7f42b; changes) is ready! 🎉 |
No, it's not fixed by that. Is my fix here unreasonable? |
If the basename was used only for printing these messages, I would probably not have bothered to look for a proper fix. |
But this is a "second level" test. We doctest I don't think this "second level" is relevant for the "stats", or is it? |
You are describing it correctly; except it's not just "printed" incorrectly. There's no such code that abbreviates identifiers further somehow, as far as I know. |
|
I agree that in this situation (running I also agree that none of this is very important, and that nothing would be wrong with fixing it the way that you do here. It's just that I cannot resist opportunities for synergetic fixes. |
Makes sense, but since I wasn't able to reproduce it using |
|
No worries, I'll test it later today or tomorrow. |
|
Ping @mkoeppe I'm switching our package to build from pypi sdist, and I was hit by this: |
|
I had not noticed that the doctest error about tdblib.pyx disappeared when I started to apply the line |
|
For the record, I switched void-linux package to pypi sdist and it's working fine with this PR as seen in void-linux/void-packages#49571 |
|
The |
sagemathgh-37650: src/sage/features/sagemath.py: Add feature SAGE_SRC <!-- ^ 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". --> This feature is for conditionalizing some doctests. Fixes doctest failure reported in sagemath#37645. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] 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#37650 Reported by: Matthias Köppe Reviewer(s): François Bissey, Gonzalo Tornaría, Matthias Köppe
Some failures I found when building and running as in #37138 (comment)
The first one is a missing
# needs tdlibwhich is not noticed when building a wheel from the github source instead of via sdist, sincetdlib.pyxis included in the former but not in the latter.The second one triggers when one installs the wheel in a random directory (not site-packages, not a venv) and runs via PYTHONPATH. Then module names like
sage.doctest.tests.toleranceare instead justtoleranceso there's a mismatch. Very easy to fix writing...toleranceinstead.📝 Checklist