Skip to content

Commit

Permalink
Use IOCapture v0.2 (#1549)
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenpi authored Mar 16, 2021
1 parent 7eac514 commit 22d4e43
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

* ![Bugfix][badge-bugfix] A bad `repo` argument to `deploydocs` containing a protocol now throws an error instead of being misinterpreted. ([#1531][github-1531], [#1533][github-1533])

* ![Maintenance][badge-maintenance] Documenter is no longer compatible with IOCapture v0.1 and now requires IOCapture v0.2. ([#1549][github-1549])

## Version `v0.26.3`

* ![Maintenance][badge-maintenance] The internal naming of the temporary modules used to run doctests changed to accommodate upcoming printing changes in Julia. ([JuliaLang/julia#39841][julia-39841], [#1540][github-1540])
Expand Down Expand Up @@ -765,6 +767,7 @@
[github-1531]: https://github.com/JuliaDocs/Documenter.jl/issues/1531
[github-1533]: https://github.com/JuliaDocs/Documenter.jl/pull/1533
[github-1540]: https://github.com/JuliaDocs/Documenter.jl/pull/1540
[github-1549]: https://github.com/JuliaDocs/Documenter.jl/pull/1549
[github-1551]: https://github.com/JuliaDocs/Documenter.jl/pull/1551

[julia-38079]: https://github.com/JuliaLang/julia/issues/38079
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

[compat]
DocStringExtensions = "0.4, 0.5, 0.6, 0.7, 0.8"
IOCapture = "0.1"
IOCapture = "0.2"
JSON = "0.19, 0.20, 0.21"
julia = "1"

Expand Down
6 changes: 3 additions & 3 deletions src/DocTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function eval_repl(block, sandbox, meta::Dict, doc::Documents.Document, page)
# see https://github.com/JuliaLang/julia/pull/33864
ex = REPL.softscope!(ex)
end
c = IOCapture.iocapture(throwerrors = :interrupt) do
c = IOCapture.capture(rethrow = InterruptException) do
Core.eval(sandbox, ex)
end
Core.eval(sandbox, Expr(:global, Expr(:(=), :ans, QuoteNode(c.value))))
Expand All @@ -243,7 +243,7 @@ function eval_script(block, sandbox, meta::Dict, doc::Documents.Document, page)
output = lstrip(output, '\n')
result = Result(block, input, output, meta[:CurrentFile])
for (ex, str) in Utilities.parseblock(input, doc, page; keywords = false, raise=false)
c = IOCapture.iocapture(throwerrors = :interrupt) do
c = IOCapture.capture(rethrow = InterruptException) do
Core.eval(sandbox, ex)
end
result.value = c.value
Expand Down Expand Up @@ -326,7 +326,7 @@ end
function error_to_string(buf, er, bt)
# Remove unimportant backtrace info.
bt = remove_common_backtrace(bt, backtrace())
# Remove everything below the last eval call (which should be the one in IOCapture.iocapture)
# Remove everything below the last eval call (which should be the one in IOCapture.capture)
index = findlast(ptr -> Base.ip_matches_func(ptr, :eval), bt)
bt = (index === nothing) ? bt : bt[1:(index - 1)]
# Print a REPL-like error message.
Expand Down
4 changes: 2 additions & 2 deletions src/Expanders.jl
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ function Selectors.runner(::Type{ExampleBlocks}, x, page, doc)
code = x.code
end
for (ex, str) in Utilities.parseblock(code, doc, page; keywords = false)
c = IOCapture.iocapture(throwerrors = :interrupt) do
c = IOCapture.capture(rethrow = InterruptException) do
cd(page.workdir) do
Core.eval(mod, ex)
end
Expand Down Expand Up @@ -611,7 +611,7 @@ function Selectors.runner(::Type{REPLBlocks}, x, page, doc)
# see https://github.com/JuliaLang/julia/pull/33864
ex = REPL.softscope!(ex)
end
c = IOCapture.iocapture(throwerrors = :interrupt) do
c = IOCapture.capture(rethrow = InterruptException) do
cd(page.workdir) do
Core.eval(mod, ex)
end
Expand Down
2 changes: 1 addition & 1 deletion test/TestUtilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Base.showerror(io::IO, e::QuietlyException)
end

function _quietly(f, expr, source)
c = IOCapture.iocapture(f; throwerrors = :interrupt)
c = IOCapture.capture(f; rethrow = InterruptException)
haskey(ENV, "DOCUMENTER_TEST_QUIETLY") && open(QUIETLY_LOG; write=true, append=true) do io
println(io, "@quietly: c.error = $(c.error) / $(sizeof(c.output)) bytes of output captured")
println(io, "@quietly: $(source.file):$(source.line)")
Expand Down
2 changes: 1 addition & 1 deletion test/doctests/doctestapi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import IOCapture
# ------------------------------------
function run_doctest(f, args...; kwargs...)
(result, success, backtrace, output) =
c = IOCapture.iocapture(throwerrors = :interrupt) do
c = IOCapture.capture(rethrow = InterruptException) do
# Running inside a Task to make sure that the parent testsets do not interfere.
t = Task(() -> doctest(args...; kwargs...))
schedule(t)
Expand Down
2 changes: 1 addition & 1 deletion test/doctests/doctests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function run_makedocs(f, mdfiles, modules=Module[]; kwargs...)
# page" warning.
touch(joinpath(srcdir, "index.md"))

c = IOCapture.iocapture(throwerrors = :interrupt) do
c = IOCapture.capture(rethrow = InterruptException) do
makedocs(
sitename = " ",
root = dir,
Expand Down

0 comments on commit 22d4e43

Please sign in to comment.