From dd91dbce0979e45fc30b4c8d4824bb61b214bd20 Mon Sep 17 00:00:00 2001 From: MichaelHatherly Date: Fri, 22 Nov 2024 15:47:18 +0000 Subject: [PATCH 1/2] Add missing `Random` import --- .../src/QuartoNotebookWorker.jl | 1 + test/examples/integrations/RCallSVG.qmd | 17 +++++++++++++++++ test/testsets/integrations/RCall.jl | 9 +++++++++ 3 files changed, 27 insertions(+) create mode 100644 test/examples/integrations/RCallSVG.qmd diff --git a/src/QuartoNotebookWorker/src/QuartoNotebookWorker.jl b/src/QuartoNotebookWorker/src/QuartoNotebookWorker.jl index ad095b7..44948f4 100644 --- a/src/QuartoNotebookWorker/src/QuartoNotebookWorker.jl +++ b/src/QuartoNotebookWorker/src/QuartoNotebookWorker.jl @@ -86,6 +86,7 @@ import InteractiveUtils import Logging import Pkg import REPL +import Random # Includes. diff --git a/test/examples/integrations/RCallSVG.qmd b/test/examples/integrations/RCallSVG.qmd new file mode 100644 index 0000000..12d062f --- /dev/null +++ b/test/examples/integrations/RCallSVG.qmd @@ -0,0 +1,17 @@ +--- +title: RCall integration +fig-width: 4 +fig-height: 3 +fig-dpi: 150 +fig-format: svg +julia: + exeflags: ["--project=RCall"] +--- + +```{julia} +using RCall +``` + +```{julia} +R"plot(1:10)" +``` diff --git a/test/testsets/integrations/RCall.jl b/test/testsets/integrations/RCall.jl index eeddffb..d3b101b 100644 --- a/test/testsets/integrations/RCall.jl +++ b/test/testsets/integrations/RCall.jl @@ -10,3 +10,12 @@ test_example(joinpath(@__DIR__, "../../examples/integrations/RCall.qmd")) do jso @test cell["outputs"][1]["metadata"]["image/png"] == Dict("width" => 600, "height" => 450) end + +test_example(joinpath(@__DIR__, "../../examples/integrations/RCallSVG.qmd")) do json + cells = json["cells"] + cell = cells[4] + output = cell["outputs"][1] + + @test !isempty(output["data"]["image/svg+xml"]) + @test isempty(cell["outputs"][1]["metadata"]) +end From 90349bc90996e3db2c6119fa5d74a94bb39e4460 Mon Sep 17 00:00:00 2001 From: MichaelHatherly Date: Fri, 22 Nov 2024 18:38:46 +0000 Subject: [PATCH 2/2] debug --- test/testsets/integrations/RCall.jl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/testsets/integrations/RCall.jl b/test/testsets/integrations/RCall.jl index d3b101b..35bf169 100644 --- a/test/testsets/integrations/RCall.jl +++ b/test/testsets/integrations/RCall.jl @@ -11,11 +11,14 @@ test_example(joinpath(@__DIR__, "../../examples/integrations/RCall.qmd")) do jso Dict("width" => 600, "height" => 450) end -test_example(joinpath(@__DIR__, "../../examples/integrations/RCallSVG.qmd")) do json - cells = json["cells"] - cell = cells[4] - output = cell["outputs"][1] +# Don't run this on macOS CI, since that appears to be missing the required libs. +if !(get(ENV, "CI", "false") == "true" && Sys.isapple()) + test_example(joinpath(@__DIR__, "../../examples/integrations/RCallSVG.qmd")) do json + cells = json["cells"] + cell = cells[4] + output = cell["outputs"][1] - @test !isempty(output["data"]["image/svg+xml"]) - @test isempty(cell["outputs"][1]["metadata"]) + @test !isempty(output["data"]["image/svg+xml"]) + @test isempty(cell["outputs"][1]["metadata"]) + end end