-
Notifications
You must be signed in to change notification settings - Fork 3
Run doctests in testing suite #38
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
base: main
Are you sure you want to change the base?
Conversation
| @@ -0,0 +1,6 @@ | |||
| # Need to load Spectra into Main to work with ParallelTestRunner | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why you need eval: https://github.com/EnzymeAD/Enzyme.jl/blob/c009fa593821cbd9017450a6721259f7dbc6ebf1/test/doctests.jl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tip. I added the @eval approach to fix failures with Documenter.jl not recognizing the package module (see here). This problem only appeared when I switched to ParallelTestRunner so I may just be configuring something improperly. The errors are things like
│ ┌ Error: Failed to evaluate `CurrentModule = AstrochemicalYields` in `@meta` block.
│ │ exception =
│ │ UndefVarError: `AstrochemicalYields` not defined in `Main`
│ │ Suggestion: check for spelling errors or missing imports.
│ │ Hint: AstrochemicalYields is loaded but not imported in the active module Main.
I fixed this by explicitly importing the package into Main using @eval.
Looking at the code in Enzyme it's not clear to me why this error occurs in my project but not in Enzyme because Enzyme has a similar @meta block in their index.md file. Any tips would be appreciated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JuliaTesting/ParallelTestRunner.jl#68. It's not always necessary, but if the output depends on the exact module where the code is being evaluated, then something like that may be needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, appreciate this info y'all
|
Thanks for opening this, Chris! I think you may be hitting on a more general issue/convention/standard? that I've never really been quite clear on: the distinction between: "CI" tests, and "Documentation" tests. We currently have these somewhat separated by design with our This is something that I have been thinking about exploring more and potentially implementing ecosystem-wide, but just never took the time. Is this something that would be worth chatting about around the |
|
Without being overly philosophical, my main opinions are
For my own packages I usually run doctests in the main CI action (as I'm suggesting here) and then disable them on the "Documentation" action. Basically the "Documentation" action only builds the documentation and all the tests are run in the "CI" action. I find this to be a better separation of concerns (that way running tests and building documentation are truly separated). If you want to start a fireplace thread you can but I'm also fine with this being a stylistic choice for individual maintainers to make with their repos. |
|
This is awesome, thanks Chris! These are exactly the kind of convos I've been wanting to have as an org, I'll go ahead and set up a fireplace thread then. While I'm in theory all for folks doing their own thing in their repos, I think there's still a lot of value (at least to new folk) in making these sorts of reasonings more transparent. And who knows, maybe one day we'll develop our own org style as we become more and more cohesive. |
This should run the doctests as part of the test suite. I don't expect this to pass now because of printing / environment stuff that we probably need to be more careful about when writing the doctests.