Skip to content

Commit

Permalink
Test default_stdout_iocontext
Browse files Browse the repository at this point in the history
Check that each IOContext property is transferred to `stdout` and
`stderr` as seen from inside a notebook
danielwe committed Feb 22, 2024
1 parent 45cf74a commit 37599e2
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/StdIOContext.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Test
import Pluto: PlutoRunner, Notebook, WorkspaceManager, Cell, ServerSession, update_run!

@testset "stdout/stderr IOContext" begin
🍭 = ServerSession()
🍭.options.evaluation.workspace_use_distributed = true

notebook = Notebook(reduce(
vcat,
# $(repr(p)) rather than just $p for parseable output, e.g., Symbols with colons
[
Cell("($(repr(p))) in stdout"),
Cell("($(repr(p))) in stderr"),
] for p in pairs(PlutoRunner.default_stdout_iocontext.dict)
))

update_run!(🍭, notebook, notebook.cells)
for cell in values(notebook.cells_dict)
@test cell.output.body == "true"
end

WorkspaceManager.unmake_workspace((🍭, notebook))
end

0 comments on commit 37599e2

Please sign in to comment.