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

Update to use Minitest 5.15.0 #217

Merged
merged 4 commits into from
Jan 9, 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
6 changes: 4 additions & 2 deletions src/testup/core.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#-------------------------------------------------------------------------------
#
# Copyright 2013-2018 Trimble Inc.
# Copyright 2013-2024 Trimble Inc.
# License: The MIT License (MIT)
#
#-------------------------------------------------------------------------------
Expand All @@ -9,7 +9,9 @@

# TODO: Defer this to a point so it doesn't happen during SketchUp startup.
require 'testup/gem_helper'
TestUp::GemHelper.require('minitest', 'minitest', version: '5.4.3')

# Minitest 5.15.0 is compatible with Ruby '>= 2.2, < 4.0', released 15-Dec-2021
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With that the .rubocop.yml should update TargetSketchUpVersion and TargetRubyVersion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure what you wanted to do, I don't think I have a complete set of old Ruby 2.2. SU versions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can have a look at the rubocop config.

TestUp::GemHelper.require('minitest', 'minitest', version: '5.15.0')

require 'testup/ui/runner' if defined?(UI::WebDialog)
require 'testup/app'
Expand Down
4 changes: 2 additions & 2 deletions src/testup/file_reporter.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#-------------------------------------------------------------------------------
#
# Copyright 2013-2016 Trimble Inc.
# Copyright 2013-2024 Trimble Inc.
# License: The MIT License (MIT)
#
#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -85,7 +85,7 @@ def report

def record(result)
super
io.puts "%s#%s = %.2f s = %s" % [result.class,
io.puts "%s#%s = %.2f s = %s" % [result.klass,
result.name,
result.time,
result.result_code]
Expand Down
7 changes: 4 additions & 3 deletions src/testup/gem_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module GemHelper
def self.require(gem_name, filename, version: Gem::Requirement.default)
Kernel.require 'rubygems'
begin
gem gem_name
gem gem_name, ">=#{version}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, nice. didn't realize you could use a flexible version here.

rescue Gem::LoadError
puts "Installing Gem: #{gem_name} (Please wait...)"
begin
Expand All @@ -24,7 +24,7 @@ def self.require(gem_name, filename, version: Gem::Requirement.default)
# a bug. This pattern is probably not that common, to be
# programmatically installing gems.
end
gem gem_name
gem gem_name, ">=#{version}"
end
Kernel.require filename
end
Expand Down Expand Up @@ -58,7 +58,8 @@ def self.install(gem_name, version = Gem::Requirement.default)
if local_path
puts '> Installing from local copy...'
puts "> #{local_path}"
Gem.install(local_path)
Gem.install(local_path, nil, {domain: :local})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This domain: local options, how far back is that supported?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruby 2.2, SU 2017. It doesn't exist in Ruby 2.0, not sure about 2.1

puts "> Installed #{gem_name}-#{version}"
else
puts '> Installing from Ruby Gems...'
Gem.install(gem_name, version)
Expand Down
Binary file added src/testup/gems/minitest-5.15.0.gem
Binary file not shown.
Binary file removed src/testup/gems/minitest-5.4.3.gem
Binary file not shown.
4 changes: 2 additions & 2 deletions src/testup/reporter.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#-------------------------------------------------------------------------------
#
# Copyright 2013-2018 Trimble Inc.
# Copyright 2013-2024 Trimble Inc.
# License: The MIT License (MIT)
#
#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -58,7 +58,7 @@ def record(result)

def process_results(result)
{
test_case_name: result.class.name,
test_case_name: result.klass,
test_name: result.name,
run_time: result.time,
skipped: result.skipped?,
Expand Down
3 changes: 3 additions & 0 deletions tests/SketchUp Ruby API/TC_Geom_Point2d.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# License:: The MIT License (MIT)
# Original Author:: Adam Karkkainen

if Geom.const_defined? :Point2d
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these conditionals for?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, for running on older SketchUp versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, for running on older SketchUp versions?

Yes. I wanted to see if it worked with Ruby 2.2, so I tried SU 2017.

The '2d' objects were new with SU 2018, JFYI, doc's refer to Layout (not SU) in their minimum version item.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, the 2d classes was introduced because of LayOut. SketchUp never really used them. I think we might have introduced some usage of them later on though.


require "testup/testcase"
require_relative "utils/frozen"
Expand Down Expand Up @@ -653,3 +654,5 @@ def test_y_Set_invalid_values
end
end
end # class

end # if Geom.const_defined? :Point2d
5 changes: 4 additions & 1 deletion tests/SketchUp Ruby API/TC_Geom_Transformation2d.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# License:: The MIT License (MIT)
# Original Author:: Adam Karkkainen

if Geom.const_defined? :Transformation2d

require "testup/testcase"
require_relative "utils/frozen"
Expand Down Expand Up @@ -484,4 +485,6 @@ def test_translation_invalid_arguments
Geom::Transformation2d.translation(matrix)
end
end
end
end

end # if Geom.const_defined? :Transformation2d
3 changes: 3 additions & 0 deletions tests/SketchUp Ruby API/TC_Geom_Vector2d.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# License:: The MIT License (MIT)
# Original Author:: Adam Karkkainen

if Geom.const_defined? :Vector2d

require "testup/testcase"
require_relative "utils/frozen"
Expand Down Expand Up @@ -1170,3 +1171,5 @@ def test_y_Set_invalid_types
end
end
end

end # if Geom.const_defined? :Vector2d