Skip to content
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

@doc changes behaviour during testing #53349

Closed
lgoettgens opened this issue Feb 15, 2024 · 3 comments
Closed

@doc changes behaviour during testing #53349

lgoettgens opened this issue Feb 15, 2024 · 3 comments
Milestone

Comments

@lgoettgens
Copy link
Contributor

We have some code doing automatic creation of docstrings in AbstractAlgebra.jl including some test around that. These tests started to fail a few days ago on julia nightly (ref Nemocas/AbstractAlgebra.jl#1608), due to the @doc macro no longer returning the docstring but only nothing.

MWE:

==> ./Project.toml <==
name = "MWE"
uuid = "f8fce2d4-4067-48d1-bd5a-dca4ed90cd6a"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]

==> ./src/MWE.jl <==
module MWE

"""
    foo()
"""
function foo()
    return 42
end

end # module MWE

==> ./test/runtests.jl <==
using MWE
using Test

@test contains(string(@doc MWE.foo), "foo()")

When running the tests from the REPL using include("test/runtests.jl"), everything is fine. However, running them via ] test fails.

A bisection has shown that the regression was introduced in c1a7bb2 (#53220), so this could as well be a Pkg.jl issue.

@vtjnash
Copy link
Sponsor Member

vtjnash commented Feb 15, 2024

Yes, this was a REPL feature that was (apparently) not supposed to be accessed by code. Typical doc usage would have see-also links rather than literally copy text. You might need to load REPL currently in your tests to get them working again

@KristofferC
Copy link
Sponsor Member

KristofferC commented Mar 4, 2024

I'll put this on the milestone. From the docstring:

The @doc macro can be used directly to both set and retrieve documentation / metadata.

Nothing says this is a REPL feature and it doesn't really make sense for it to be.

@Tortar
Copy link
Contributor

Tortar commented Mar 4, 2024

Dup of #52986

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants