Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #142, InteractiveUtils should be imported by default #148

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
CommonMark = "a80b9123-70ca-4bc0-993e-6e3bcb318db6"
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
IOCapture = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Expand All @@ -30,6 +31,7 @@ Base64 = "1.6"
CommonMark = "0.8"
Compat = "4"
IOCapture = "0.2"
InteractiveUtils = "1.6"
IterTools = "1"
JSON3 = "1"
Logging = "1.6"
Expand Down
1 change: 1 addition & 0 deletions src/QuartoNotebookRunner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Base64
import CommonMark
import Compat
import IOCapture
import InteractiveUtils
import IterTools
import JSON3
import Logging
Expand Down
1 change: 1 addition & 0 deletions src/QuartoNotebookWorker/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ authors = ["MichaelHatherly <[email protected]>"]
version = "0.1.0"

[deps]
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
Expand Down
6 changes: 5 additions & 1 deletion src/QuartoNotebookWorker/src/NotebookState.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@
# Add some default imports. Rather than directly using `import` we just
# `const` them directly from the `Function` objects themselves.
imports = quote
const Pkg = $(Pkg)
# We can import `QuartoNotebookWorker` since we have pushed it onto the
# end of `LOAD_PATH`.
import QuartoNotebookWorker.Pkg
using QuartoNotebookWorker.InteractiveUtils

Check warning on line 45 in src/QuartoNotebookWorker/src/NotebookState.jl

View check run for this annotation

Codecov / codecov/patch

src/QuartoNotebookWorker/src/NotebookState.jl#L44-L45

Added lines #L44 - L45 were not covered by tests

const ojs_define = $(QuartoNotebookWorker.ojs_define)
const include = $(QuartoNotebookWorker.NotebookInclude.include)
const eval = $(QuartoNotebookWorker.NotebookInclude.eval)
Expand Down
1 change: 1 addition & 0 deletions src/QuartoNotebookWorker/src/QuartoNotebookWorker.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ end

# Imports.

import InteractiveUtils
import Pkg
import REPL

Expand Down
3 changes: 3 additions & 0 deletions test/examples/cell_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ println(1)

# %%
div(1, 0)

# %%
versioninfo()
4 changes: 4 additions & 0 deletions test/examples/cell_types.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ Errors:

```{julia}
div(1, 0)
```

```{julia}
versioninfo()
```
10 changes: 9 additions & 1 deletion test/testsets/cell_types.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include("../utilities/prelude.jl")

test_example(joinpath(@__DIR__, "../examples/cell_types.qmd")) do json
@test length(json["cells"]) == 6
@test length(json["cells"]) == 8

cell = json["cells"][1]
@test cell["cell_type"] == "markdown"
Expand Down Expand Up @@ -42,4 +42,12 @@ test_example(joinpath(@__DIR__, "../examples/cell_types.qmd")) do json
@test contains(traceback, "div")
@test count("top-level scope", traceback) == 1
@test count(r"cell_types\.(qmd|jl):", traceback) == 1

cell = json["cells"][8]
outputs = cell["outputs"]
@test length(outputs) == 1
output = outputs[1]
@test output["output_type"] == "stream"
@test output["name"] == "stdout"
@test startswith(output["text"], "Julia Version ")
end
2 changes: 1 addition & 1 deletion test/testsets/socket_server/socket_server.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ include("../../utilities/prelude.jl")
@test d1 == false

d2 = json(`$node $client $(server.port) $(server.key) run $(cell_types)`)
@test length(d2["notebook"]["cells"]) == 6
@test length(d2["notebook"]["cells"]) == 8

d3 = json(`$node $client $(server.port) $(server.key) isopen $(cell_types)`)
@test d3 == true
Expand Down
Loading