Documenter.doctest(MyPackage; manual=false) inside
runtests.jl to run the doctests in my package (as explained here). In one of the doctests, I need to access an artifact. e.g.
artifact"myartifact" . I’m getting the following error when I run the tests:
Cannot locate '(Julia)Artifacts.toml' file when attempting to use artifact 'myartifact' in 'Main'
Where do I need to store
Artifacts.toml ? Storing it in the package root dir, docs dir or test dir does not seem to work.
Solution by @fredrikekre in Accessing an artifact inside a doctest · Issue #1963 · JuliaDocs/Documenter.jl · GitHub
Easiest (and most common?) way is to expand the macro in your package and only use a regular binding from the outside, e.g.
myartifact = artifact"myartifact"
in your package, and then use
from the outside.
The fact that
artifact"..." works in the REPL/Main (I think it does?) is mostly for convenience IIRC, but it doesn’t work in arbitrary modules, like the temp ones that are used for doctesting in Documenter.
Is there any other way? I have an artifact that is specific to the docs, which I don’t think makes a lot of sense to download on every package installation.