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
  • Loading branch information
danielwe committed Feb 22, 2024
1 parent 45cf74a commit b0851f5
Show file tree
Hide file tree
Showing 2 changed files with 25 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
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ verify_no_running_processes()
verify_no_running_processes()
@timeit_include("MacroAnalysis.jl")
verify_no_running_processes()
@timeit_include("StdIOContext.jl")
verify_no_running_processes()
@timeit_include("Logging.jl")
verify_no_running_processes()
@timeit_include("webserver.jl")
Expand Down

0 comments on commit b0851f5

Please sign in to comment.