Skip to content

Commit

Permalink
add env to make Random available
Browse files Browse the repository at this point in the history
  • Loading branch information
jkrumbiegel committed Oct 14, 2024
1 parent 24a7eff commit 102fe6d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 2 additions & 0 deletions test/examples/random_seed/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[deps]
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
File renamed without changes.
12 changes: 2 additions & 10 deletions test/testsets/random_seed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include("../utilities/prelude.jl")

@testset "seeded random numbers are consistent across runs" begin
mktempdir() do dir
content = read(joinpath(@__DIR__, "../examples/random_seed.qmd"), String)
content = read(joinpath(@__DIR__, "../examples/random_seed/random_seed.qmd"), String)
cd(dir) do
server = QuartoNotebookRunner.Server()
write("notebook.qmd", content)
Expand All @@ -11,15 +11,7 @@ include("../utilities/prelude.jl")
QuartoNotebookRunner.run!(server, "notebook.qmd"; showprogress = false)
end

function _output(cell)
try
only(cell.outputs).data["text/plain"]
catch e
@error "extracting outputs failed"
display(cell)
rethrow(e)
end
end
_output(cell) = only(cell.outputs).data["text/plain"]

@test tryparse(Float64, _output(jsons[1].cells[2])) !== nothing
@test tryparse(Float64, _output(jsons[1].cells[4])) !== nothing
Expand Down

0 comments on commit 102fe6d

Please sign in to comment.