-
-
Notifications
You must be signed in to change notification settings - Fork 482
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
Use pytest to run doctests #33546
Comments
Dependencies: #33549 |
This comment has been minimized.
This comment has been minimized.
Changed dependencies from #33549 to none |
Branch: public/tests/pytest_doctests |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Commit: |
Dependencies: #33572 |
comment:7
In principle this seems to work now. To test, run Any idea why the import of |
Branch pushed to git repo; I updated commit sha1. New commits:
|
This comment has been minimized.
This comment has been minimized.
comment:9
There are still a few issues, but as a first version it should be good to go. |
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
|
This comment has been minimized.
This comment has been minimized.
Replying to @mkoeppe:
Would it be possible to add a doctest for that? |
comment:13
A concern from #33531: I couldn't help but notice that pytest will use a single thread to run, which is a HUGE regression if tests start migrating from the sage doctest framework to pytest !!! Right now running pytest through all these 9 files takes 80s, while the doctest step in --long --all mode takes just 312s wall time (using 36 threads). |
comment:14
There are plugins that enable parallel processing of tests like https://github.com/pytest-dev/pytest-xdist and https://github.com/browsertron/pytest-parallel. Let's keep this in mind and do it as a follow-up (especially since I'm not sure how well tested sage is with concurrent runs). |
comment:15
Replying to @tobiasdiez:
I haven't tested it, but won't this ticket lead to failures when |
comment:16
Replying to @tobiasdiez:
Parallel doctesting WORKS. As mentioned above, I can use 36 threads to doctest in --long --all mode in just 312s wall time (instead of ~3 hours which would take using a single thread). Have you actually tried using those plugins? They are not available in my distro (void linux). Non-rethorical question: what is the advantage of pytest over the current sage doctest framework? |
comment:17
Replying to @tornaria:
My own answer: should sage developers build and maintain their own unique testing framework when there are mature testing framework around? Could their time be better used if they didn't have to maintain that framework that no one else (apart possibly a few downstream package) uses or want? |
comment:18
Replying to @tornaria:
If I'm not mistaken that only runs the tests in multiple independent workers and thus is only parallelism (i.e. pytest-xdist). But as far as I'm aware there are no extensive tests of sage with concurrency, that is, with multiple threads sharing the same state (i.e. pytest-parallel). Anyway, both packages are ordinary pip installable packages. |
comment:19
Replying to @kiwifb:
Cannot agree more. Plus using standard tools increases synergy effects, for example IDEs have special support for pytest but not for sage's custom test runner. Also new developers might have heard of and used pytest before, but have to learn sage's test runner conventions (eg command line args). |
comment:27
|
comment:28
Also could you update the ticket description please? |
This comment has been minimized.
This comment has been minimized.
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:31
Replying to @mkoeppe:
You are right. Not sure why I've added them in the first place, but I've removed them now. |
comment:32
In a build without
|
comment:33
I cannot reproduce this on gitpod (which uses the editable install but is currently my only means to test things). The strange thing is that this part of the import code shouldn't be invoked at all and this exception is only raised in the pre/append import mode. https://github.com/pytest-dev/pytest/blob/f22451717d95d9938d95019d6399a509487f35dd/src/_pytest/pathlib.py#L492-L508 vs https://github.com/pytest-dev/pytest/blob/f22451717d95d9938d95019d6399a509487f35dd/src/_pytest/pathlib.py#L556. For some reason pytest is not picking up the config from the tox ini correctly in your case. Can you please try to add |
comment:34
You can just reconfigure without --enable-editable and rebuild to test |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:36
Should work now. |
Reviewer: Matthias Koeppe |
comment:38
I've opened tickets for the follow-ups. |
This comment has been minimized.
This comment has been minimized.
comment:39
Two times thanks! |
Changed branch from public/tests/pytest_doctests to |
comment:41
see #34828 for further discussion on doctesting and |
Changed commit from |
comment:42
Replying to Dima Pasechnik:
Opened a followup ticket #34829 to deal with this. |
As suggested in #33232 comment:1,
./sage --pytest
now uses pytest to discover and run doctests.To test, run
./sage --pytest src/sage/manifolds/
. This results inWith many of the failed tests being due to some issues with assumptions and/or symbolic variables and/or deprecation warnings.
To see examples of these failures, run pytest on
We also add tests that verify that
sage --pytest
(andsage -t
) correctly complain about failing doctests.Follow-ups:
pytest-parallel
orpytest-xdist
to run pytest in parallelDepends on #33572
CC: @tobiasdiez @tornaria
Component: doctest framework
Author: Tobias Diez
Branch:
cc19e92
Reviewer: Matthias Koeppe
Issue created by migration from https://trac.sagemath.org/ticket/33546
The text was updated successfully, but these errors were encountered: