diff --git a/Gemfile b/Gemfile index b76e937..febbf20 100644 --- a/Gemfile +++ b/Gemfile @@ -15,3 +15,8 @@ end group :test do gem 'cztop' end + +# Tests are failing on Ruby 3.3 because warnings related to OpenStruct are being written to the standard error output. +# This is being captured by Open3.capture2e and then mistakenly parsed as JSON. +# This gem can be removed when json gem is updated +gem 'ostruct' diff --git a/lib/iruby/application.rb b/lib/iruby/application.rb index ba71fd8..7a7bf7c 100644 --- a/lib/iruby/application.rb +++ b/lib/iruby/application.rb @@ -265,7 +265,7 @@ def register_kernel(argv) opts.on( "--display-name=VALUE", String, "Specify the display name for the kernelspec. This is helpful when you have multiple IRuby kernels." - ) {|v| kernel_display_name = v } + ) {|v| params.display_name = v } # TODO: --profile # TODO: --prefix diff --git a/lib/iruby/backend.rb b/lib/iruby/backend.rb index 967de39..156d78f 100644 --- a/lib/iruby/backend.rb +++ b/lib/iruby/backend.rb @@ -50,6 +50,7 @@ def initialize @irb = IRB::Irb.new(@workspace) @eval_path = @irb.context.irb_path IRB.conf[:MAIN_CONTEXT] = @irb.context + @completor = IRB::RegexpCompletor.new end def eval_binding @@ -62,7 +63,8 @@ def eval(code, store_history) end def complete(code) - IRB::InputCompletor::CompletionProc.call(code) + # preposing and postposing never used, so they are empty, pass only target as code + @completor.completion_candidates('', code, '', bind: @workspace.binding) end private diff --git a/lib/iruby/display.rb b/lib/iruby/display.rb index f497656..fb392b0 100644 --- a/lib/iruby/display.rb +++ b/lib/iruby/display.rb @@ -113,14 +113,14 @@ def ascii?(mime) if FORCE_TEXT_TYPES.include?(mime) true else - MIME::Type.new(mime).ascii? + MIME::Type.new("content-type" => mime).ascii? end end private def render_mimebundle(obj, exact_mime, fuzzy_mime) data = {} include_mime = [exact_mime].compact - formats, metadata = obj.to_iruby_mimebundle(include: include_mime) + formats, _metadata = obj.to_iruby_mimebundle(include: include_mime) formats.each do |mime, value| if fuzzy_mime.nil? || mime.include?(fuzzy_mime) data[mime] = value @@ -407,7 +407,6 @@ def format(mime = nil, &block) type { Gruff::Base } format 'image' do |obj| - image = obj.to_image format_magick_image.(obj.to_image) end diff --git a/lib/iruby/ostream.rb b/lib/iruby/ostream.rb index dd0dd1b..d04a224 100644 --- a/lib/iruby/ostream.rb +++ b/lib/iruby/ostream.rb @@ -48,7 +48,7 @@ def writelines(lines) # Called by irb def set_encoding(extern, intern) - a = extern + extern end private diff --git a/test/iruby/application/kernel_test.rb b/test/iruby/application/kernel_test.rb index 007af39..a79ee2e 100644 --- a/test/iruby/application/kernel_test.rb +++ b/test/iruby/application/kernel_test.rb @@ -83,7 +83,7 @@ def setup add_kernel_options("--log=#{log_file}", boot_file) - out, status = Open3.capture2e(*iruby_command("console"), in: :close) + _out, status = Open3.capture2e(*iruby_command("console"), in: :close) assert status.success? assert_path_exist log_file assert_match(/\bINFO -- bootfile: !!! LOG MESSAGE FROM BOOT FILE !!!$/, File.read(log_file)) diff --git a/test/iruby/application/register_test.rb b/test/iruby/application/register_test.rb index bc7b3a4..4a88e0d 100644 --- a/test/iruby/application/register_test.rb +++ b/test/iruby/application/register_test.rb @@ -61,7 +61,7 @@ def setup test("a new IRuby kernel `#{DEFAULT_KERNEL_NAME}` will be installed in JUPYTER_DATA_DIR") do assert_path_not_exist @kernel_json - out, status = Open3.capture2e(*iruby_command("register")) + _out, status = Open3.capture2e(*iruby_command("register")) assert status.success? assert_path_exist @kernel_json