Skip to content

Commit

Permalink
Merge pull request #202146 from Homebrew/jupyterlab-test
Browse files Browse the repository at this point in the history
jupyterlab: replace `expect` dependency with Ruby libs
  • Loading branch information
BrewTestBot authored Dec 23, 2024
2 parents f94c7b4 + 24c8f8b commit c356b43
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions Formula/j/jupyterlab.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class Jupyterlab < Formula
depends_on "[email protected]"
depends_on "zeromq"

uses_from_macos "expect" => :test
uses_from_macos "libffi"
uses_from_macos "libxml2"
uses_from_macos "libxslt"
Expand Down Expand Up @@ -559,22 +558,17 @@ def caveats
end

test do
system bin/"jupyter-console --help"
assert_match "The Jupyter terminal-based Console", shell_output("#{bin}/jupyter-console --help")
assert_match python3, shell_output("#{bin}/jupyter kernelspec list")

(testpath/"console.exp").write <<~EOS
spawn #{bin}/jupyter-console
expect -timeout 60 "In "
send "exit\r"
EOS
assert_match "Jupyter console", shell_output("expect -f console.exp")

(testpath/"notebook.exp").write <<~EOS
set timeout 60
spawn #{bin}/jupyter notebook --no-browser
expect "ServerApp"
EOS
assert_match "ServerApp", shell_output("expect -f notebook.exp")
assert_match(/In \[1\]:.*exit.*Shutting down/m, pipe_output("#{bin}/jupyter-console 2>&1", "exit"))

require "expect"
require "open3"
Open3.popen3(bin/"jupyter", "notebook", "--no-browser") do |_stdin, _stdout, stderr, wait_thread|
refute_nil stderr.expect("Serving notebooks from local directory:", 15), "Expected running message"
ensure
Process.kill "TERM", wait_thread.pid
end

(testpath/"nbconvert.ipynb").write <<~JSON
{
Expand Down

0 comments on commit c356b43

Please sign in to comment.