JuliaDocs / Documenter.jl

A documentation generator for Julia.
https://documenter.juliadocs.org
MIT License
816 stars 480 forks source link

Block-level teardown code #2058

Open fingolfin opened 1 year ago

fingolfin commented 1 year ago

For jldoctests, one can assign block-level setup code, but there doesn't seem to be a teardown counterpart. Application: modify a global setting before jldoctest starts (using setup code), and then resetting it afterwards (using teardown code).

Hypothetical example:

julia> foo(2)  # behavior depends on the global setting
4

Or perhaps there is already a way for this that I missed in the manual?

mortenpi commented 1 year ago

This sounds reasonable to me. Maybe something like DocTestTeardown and teardown? Or is there a better antonym for "setup" in this context?

fingolfin commented 1 year ago

Those names sound good to me. I don't know a better antonym to "setup" than teardown.