-
Notifications
You must be signed in to change notification settings - Fork 481
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
Generalize doctest() API #1054
Generalize doctest() API #1054
Conversation
I'll create a branch in Query.jl to test this! |
I tried it with queryverse/Query.jl#269, and it all seems to work. The thing won't work for the CI builds because they don't pick up this branch here of Documenter, but locally it all looked great. One thing I particularly like is that this does not pick up anything from the |
Why? |
I'm not checking in a I think one important aspect is that if my active env is say shared |
So you would have to add all doc dependendencies as test dependencies then? |
Yes, that is what I did for the Query.jl branch. I could see this all being more elegant with some of the sub-project stuff that is coming? But for now this seems fine. |
One weird thing I ran across: when I ran the doctests as part of Not sure what is going on, and I never understood when I have to add the module name in the output, but it looks a little as if one needs to do this differently when the doctests are run from |
Thats because |
Cool, thanks for pointing me to that, I always wanted to know what is going on there :) So the story then is that in The short term fix is simple: I'll just add |
(cherry picked from commit 1e9c615)
Can it be just (PS: It's great to see that doctests are decoupled from documentation!) |
That's a good idea, but I'll leave the implementation for another time, since it's a bit of work to make it happen (#1053). |
How about defining it as |
That's a fair point. I am inclined to keep the What about @testset "Doctests: MyPackage" begin
@test doctest(MyPackage)
end |
My honest impression is that it's not clear what the target user of FYI, I created a test helper tool https://github.com/tkf/Aqua.jl#quick-usage (though not related to doctest at all). I use the API like |
I think it makes sense if you decide to go with |
@tkf You won me over. The |
Great. Thank you for being open minded! |
doctest() can now also doctest manual pages, which makes it easier to include doctesting as part of the test suite, and behaves like a testset.
Updates the API. You can now simply call
doctest(::Module)
, and it will doctest both docstrings and manual pages, e.g.:For more control, one can also use the
doctest(source, modules)
method, which does the heavy lifting (e.g. to test a set of modules, but no pages, you can calldoctest(nothing, [Module1, Module2, ...])
).Finally, it also adds the
fix
keyword to the methods, to run the doctest fixing machinery. This actually means you can fix doctests pretty easily in the REPL now:cc @davidanthoff You don't happen to have any suggestions for packages where we could test this in the wild?
Should also fix the
dev/
docs for Documenter, since we're now using thedoctest
function inruntests.jl
.Close #1051, close #1052