-
Notifications
You must be signed in to change notification settings - Fork 29
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 for flint.types.arb
take a very long time
#184
Comments
I think that there are just one or two doctests that take almost all of the time. We could mark them to be skipped. I often run the tests like This takes under a second:
|
Yeah I also generally run with --test to avoid the doctests but I just thought I'd flag this as I think there's just a few slow functions which we could maybe speed up by using different params |
I'm sure that the slow tests could be made faster by using different parameters but I also imagine that the parameters were chosen deliberately to demonstrate that arb can solve some difficult problem. This is why I don't like using doctests as main tests. Inevitably you end up with this tension where the examples that are useful in the documentation are not good choices for the test suite or vice versa. In this case the issue is that it makes sense to demonstrate a slow thing in the docs but we probably don't get much value from running that slow thing in the standard test suite every time. In other cases we will want to test edge cases but it usually doesn't make sense to have docs that are full of examples showing trivial output for edge cases. Generally it is better if we keep a clear distinction between main tests and doctests. The purpose of the main tests is to test that the code works. The purpose of the docs is to communicate things to users. The purpose of the doctests is to test that the docs are correct which helps ensure that the docs are useful to users. |
Okay, I'm happy to close this then if you are :) |
Another problem here is that actually every doctest gets run twice. I'm not sure what causes that... |
Actually I'm not sure about this any more... In any case this is the slow test. If we skip it then the time to rebuild (if code not changed), run the all tests and doctests with diff --git a/src/flint/types/arb.pyx b/src/flint/types/arb.pyx
index 3a28a4e..8a17058 100644
--- a/src/flint/types/arb.pyx
+++ b/src/flint/types/arb.pyx
@@ -2239,7 +2239,7 @@ cdef class arb(flint_scalar):
>>> from flint import showgood
>>> showgood(lambda: arb("9/10").hypgeom_2f1(arb(2).sqrt(), 0.5, arb(2).sqrt()+1.5, abc=True), dps=25)
1.447530478120770807945697
- >>> showgood(lambda: arb("9/10").hypgeom_2f1(arb(2).sqrt(), 0.5, arb(2).sqrt()+1.5), dps=25)
+ >>> showgood(lambda: arb("9/10").hypgeom_2f1(arb(2).sqrt(), 0.5, arb(2).sqrt()+1.5), dps=25) # doctest: +SKIP
Traceback (most recent call last):
...
ValueError: no convergence (maxprec=960, try higher maxprec) |
I got really confused about this too, i think it's run once but for some reason the error is printed twice? |
Whoops wasn't aware of this until now. This is now fixed by #216 (definition of scope creep but oh well). Doctest was finding and running each doc test in module only once, each doc test just happened to be duplicated in cython |
This is now fixed. Thanks! |
They're about 99% of all the testing time for me, maybe we should modify them?
The text was updated successfully, but these errors were encountered: