minitest 5.25.5 → 5.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2ea23b9f86dd37b5f5f3d45fb451303827cbdf9414215d8f769da3624184325
4
- data.tar.gz: 3d976e8b864261af92ba50d466235e4fa529f31d3560d60ec4deba8e724fc872
3
+ metadata.gz: ecf3d390663e8f655908e6feef0796c5666930f979a0010e27d5adf4956b0bfc
4
+ data.tar.gz: be16818cbc164296bdacde79856532e5695bd6e45dec7d28e624e75bbccbf465
5
5
  SHA512:
6
- metadata.gz: 1258d24412b8461fe9a94acb9b795a1cd2a25db2d16f924ce6367662478d9e0672532636b5a2ccd809f549ba8ba6ab8f0cbeb6e8a249b1b91161cc4297f31c92
7
- data.tar.gz: 4d6a977e948f40d05e7786d07656616e9f3a4e4469a59e7b5a8e571b8f6821284989156ca4225e8e7a29cfe640bbaf544248697e14536f7c63946ffc2a34232e
6
+ metadata.gz: 4690ff166d9757befd4365ca3ca77443e4252c32132e91933093548b179ae051cade595e1a085e373e9f6a32b4677d38073cfc1b6e386a00bf77edc8cffad487
7
+ data.tar.gz: 923c90aaff33957818b8fcb053bf9fb28c01953ec910d42114cd3ba09204a0166e85824fb7188bc944f12a7855c47c0e6f63a39d2f45fcb37f25b8176416cd18
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,24 @@
1
+ === 5.26.0 / 2025-10-07
2
+
3
+ The Seattle.rb Nerd Party, Slightly Tipsy Edition!
4
+
5
+ * 2 minor enhancements:
6
+
7
+ * Added extra documentation to Minitest::TestTask options.
8
+ * Make parallelize_me! a no-op when n_threads=1.
9
+
10
+ * 9 bug fixes:
11
+
12
+ * Bypass parallel_executor entirely when n_threads=1.
13
+ * Don't require rubygems in Rakefile... it is 2025.
14
+ * Ensure that minitest exits non-zero on Interrupt. (tavianator)
15
+ * Fix Minitest.run sequence rdoc to include loop vars and read consistently.
16
+ * Fix call to parallel_executor.shutdown when it isn't defined.
17
+ * Removed some 1.8/1.9-based code from the assertions and expectations.
18
+ * Still fighting with rdoc? Yup. Still fighting with rdoc...
19
+ * Switched assert_equal's diff from Tempfile.open to Tempfile.create.
20
+ * Use Regexp.escape for BASE_RE in case pwd has special chars. (astra_1993)
21
+
1
22
  === 5.25.5 / 2025-03-12
2
23
 
3
24
  * 4 bug fixes:
data/Rakefile CHANGED
@@ -1,6 +1,5 @@
1
1
  # -*- ruby -*-
2
2
 
3
- require "rubygems"
4
3
  require "hoe"
5
4
  $:.unshift "lib" # to pick up lib/minitest/test_task.rb when minitest not installed
6
5
 
@@ -62,11 +62,11 @@ module Minitest
62
62
  return "Expected: #{mu_pp exp}\n Actual: #{mu_pp act}" unless
63
63
  expect
64
64
 
65
- Tempfile.open "expect" do |a|
65
+ Tempfile.create "expect" do |a|
66
66
  a.puts expect
67
67
  a.flush
68
68
 
69
- Tempfile.open "butwas" do |b|
69
+ Tempfile.create "butwas" do |b|
70
70
  b.puts butwas
71
71
  b.flush
72
72
 
@@ -500,14 +500,9 @@ module Minitest
500
500
  value = catch sym do
501
501
  begin
502
502
  yield
503
- rescue ThreadError => e # wtf?!? 1.8 + threads == suck
504
- default += ", not :#{e.message[/uncaught throw \`(\w+?)\'/, 1]}"
505
- rescue ArgumentError => e # 1.9 exception
503
+ rescue ArgumentError => e # 1.9+ exception
506
504
  raise e unless e.message.include? "uncaught throw"
507
505
  default += ", not #{e.message.split(/ /).last}"
508
- rescue NameError => e # 1.8 exception
509
- raise e unless e.name == sym
510
- default += ", not #{e.name.inspect}"
511
506
  end
512
507
  caught = false
513
508
  end
data/lib/minitest/spec.rb CHANGED
@@ -38,7 +38,11 @@ class Module # :nodoc:
38
38
  end
39
39
  end
40
40
 
41
- Minitest::Expectation = Struct.new :target, :ctx # :nodoc:
41
+ # :stopdoc:
42
+ module Minitest # fucking hell rdoc...
43
+ Expectation = Struct.new :target, :ctx
44
+ end
45
+ # :startdoc:
42
46
 
43
47
  ##
44
48
  # Kernel extensions for minitest
@@ -285,9 +289,7 @@ class Minitest::Spec < Minitest::Test
285
289
  defined?(@name) ? @name : super
286
290
  end
287
291
 
288
- def to_s # :nodoc:
289
- name # Can't alias due to 1.8.7, not sure why
290
- end
292
+ alias to_s name
291
293
 
292
294
  attr_reader :desc # :nodoc:
293
295
  alias specify it
data/lib/minitest/test.rb CHANGED
@@ -58,6 +58,7 @@ module Minitest
58
58
  # tests are awesome.
59
59
 
60
60
  def self.parallelize_me!
61
+ return unless Minitest.parallel_executor
61
62
  include Minitest::Parallel::Test
62
63
  extend Minitest::Parallel::Test::ClassMethods
63
64
  end
@@ -44,8 +44,16 @@ module Minitest # :nodoc:
44
44
  WINDOWS = RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ # :nodoc:
45
45
 
46
46
  ##
47
- # Create several test-oriented tasks under +name+. Takes an
48
- # optional block to customize variables.
47
+ # Create several test-oriented tasks under +name+ (default:
48
+ # "test"). Takes an optional block to customize variables.
49
+ # Examples:
50
+ #
51
+ # Minitest::TestTask.create # named "test", all defaults
52
+ #
53
+ # Minitest::TestTask.create do |t|
54
+ # t.warning = false # my tests are noisy
55
+ # t.framework = %(require_relative "./test/helper.rb")
56
+ # end
49
57
 
50
58
  def self.create name = :test, &block
51
59
  task = new name
@@ -69,9 +77,18 @@ module Minitest # :nodoc:
69
77
 
70
78
  ##
71
79
  # The code to load the framework. Defaults to requiring
72
- # minitest/autorun...
80
+ # minitest/autorun.
81
+ #
82
+ # If you have a test helper file that requires minitest/autorun
83
+ # and anything else your project standardizes on, then you'll
84
+ # probably want to change this to:
73
85
  #
74
- # Why do I have this as an option?
86
+ # Minitest::TestTask.create do |t|
87
+ # t.framework = %(require_relative "./test/helper.rb")
88
+ # end
89
+ #
90
+ # or something similar. NOTE: if you do this, then helper must
91
+ # require "minitest/autorun" at the top to start the tests.
75
92
 
76
93
  attr_accessor :framework
77
94
 
@@ -100,6 +117,11 @@ module Minitest # :nodoc:
100
117
 
101
118
  ##
102
119
  # Optional: Additional ruby to run before the test framework is loaded.
120
+ # Example:
121
+ #
122
+ # Minitest::TestTask.create "test:cov" do |t|
123
+ # t.test_prelude = %(require "simplecov")
124
+ # end
103
125
 
104
126
  attr_accessor :test_prelude
105
127
 
data/lib/minitest.rb CHANGED
@@ -10,7 +10,7 @@ require_relative "minitest/compress"
10
10
  # runtime. See +Minitest.run+ for more information.
11
11
 
12
12
  module Minitest
13
- VERSION = "5.25.5" # :nodoc:
13
+ VERSION = "5.26.0" # :nodoc:
14
14
 
15
15
  @@installed_at_exit ||= false
16
16
  @@after_run = []
@@ -36,7 +36,7 @@ module Minitest
36
36
  warn "DEPRECATED: use MT_CPU instead of N for parallel test runs" if ENV["N"] && ENV["N"].to_i > 0
37
37
  n_threads = (ENV["MT_CPU"] || ENV["N"] || Etc.nprocessors).to_i
38
38
 
39
- self.parallel_executor = Parallel::Executor.new n_threads
39
+ self.parallel_executor = Parallel::Executor.new n_threads if n_threads > 1
40
40
 
41
41
  ##
42
42
  # Filter object for backtraces.
@@ -259,12 +259,13 @@ module Minitest
259
259
  # Minitest.process_args
260
260
  # Minitest.init_plugins
261
261
  # Minitest.__run(reporter, options)
262
- # Runnable.runnables.each
262
+ # Runnable.runnables.each |runnable_klass|
263
263
  # runnable_klass.run(reporter, options)
264
- # self.runnable_methods.each
265
- # self.run_one_method(self, runnable_method, reporter)
266
- # Minitest.run_one_method(klass, runnable_method)
267
- # klass.new(runnable_method).run
264
+ # filtered_methods = runnable_methods.select {...}.reject {...}
265
+ # filtered_methods.each |runnable_method|
266
+ # runnable_klass.run_one_method(self, runnable_method, reporter)
267
+ # Minitest.run_one_method(runnable_klass, runnable_method)
268
+ # runnable_klass.new(runnable_method).run
268
269
 
269
270
  def self.run args = []
270
271
  self.load_plugins unless args.delete("--no-plugins") || ENV["MT_NO_PLUGINS"]
@@ -286,18 +287,19 @@ module Minitest
286
287
  reporter.start
287
288
  begin
288
289
  __run reporter, options
290
+ finished = true
289
291
  rescue Interrupt
290
292
  warn "Interrupted. Exiting..."
291
293
  end
292
- self.parallel_executor.shutdown
294
+ self.parallel_executor.shutdown if parallel_executor.respond_to? :shutdown
293
295
 
294
296
  # might have been removed/replaced during init_plugins:
295
297
  summary = reporter.reporters.grep(SummaryReporter).first
296
298
 
297
299
  reporter.report
298
300
 
299
- return empty_run! options if summary && summary.count == 0
300
- reporter.passed?
301
+ return empty_run! options if finished && summary && summary.count == 0
302
+ finished and reporter.passed?
301
303
  end
302
304
 
303
305
  def self.empty_run! options # :nodoc:
@@ -1079,7 +1081,7 @@ module Minitest
1079
1081
  self.error.backtrace
1080
1082
  end
1081
1083
 
1082
- BASE_RE = %r%#{Dir.pwd}/% # :nodoc:
1084
+ BASE_RE = %r%#{Regexp.escape Dir.pwd}/% # :nodoc:
1083
1085
 
1084
1086
  def message # :nodoc:
1085
1087
  bt = Minitest.filter_backtrace(self.backtrace).join("\n ")
@@ -318,13 +318,13 @@ class TestMinitestAssertions < Minitest::Test
318
318
  end
319
319
 
320
320
  def test_assert_equal_string_both_escaped_unescaped_newlines
321
- msg = <<~EOM
321
+ msg = <<~'EOM' # NOTE: single quotes on heredoc
322
322
  --- expected
323
323
  +++ actual
324
324
  @@ -1,2 +1 @@
325
- -"A\\n
325
+ -"A\n
326
326
  -B"
327
- +"A\\n\\\\nB"
327
+ +"A\n\\nB"
328
328
  EOM
329
329
 
330
330
  assert_triggered msg do
@@ -710,8 +710,6 @@ describe Minitest::Spec do
710
710
  end
711
711
 
712
712
  describe Minitest::Spec, :let do
713
- i_suck_and_my_tests_are_order_dependent!
714
-
715
713
  def _count
716
714
  $let_count ||= 0
717
715
  end
@@ -722,21 +720,21 @@ describe Minitest::Spec, :let do
722
720
  end
723
721
 
724
722
  it "is evaluated once per example" do
725
- _(_count).must_equal 0
723
+ exp = _count + 1
726
724
 
727
- _(count).must_equal 1
728
- _(count).must_equal 1
725
+ _(count).must_equal exp
726
+ _(count).must_equal exp
729
727
 
730
- _(_count).must_equal 1
728
+ _(_count).must_equal exp
731
729
  end
732
730
 
733
731
  it "is REALLY evaluated once per example" do
734
- _(_count).must_equal 1
732
+ exp = _count + 1
735
733
 
736
- _(count).must_equal 2
737
- _(count).must_equal 2
734
+ _(count).must_equal exp
735
+ _(count).must_equal exp
738
736
 
739
- _(_count).must_equal 2
737
+ _(_count).must_equal exp
740
738
  end
741
739
 
742
740
  it 'raises an error if the name begins with "test"' do
@@ -662,7 +662,7 @@ class TestMinitestRunner < MetaMetaMetaTestCase
662
662
  2 runs, 2 assertions, 0 failures, 0 errors, 0 skips
663
663
  EOM
664
664
 
665
- skip if Minitest.parallel_executor.size < 2 # locks up test runner if 1 CPU
665
+ skip unless Minitest.parallel_executor # locks up test runner if 1 CPU
666
666
 
667
667
  assert_report expected do |reporter|
668
668
  reporter.extend Module.new {
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.25.5
4
+ version: 5.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -28,7 +28,7 @@ cert_chain:
28
28
  bwfinv7Yp5fA6AysuZLhCykyfDuZVRrUp0Vb68YCKsLjJly/Theak+euNTxvHsB+
29
29
  al9oSgPPHICMEX65qvLywitx
30
30
  -----END CERTIFICATE-----
31
- date: 2025-03-12 00:00:00.000000000 Z
31
+ date: 1980-01-02 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rdoc
@@ -56,14 +56,14 @@ dependencies:
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '4.2'
59
+ version: '4.3'
60
60
  type: :development
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '4.2'
66
+ version: '4.3'
67
67
  description: |-
68
68
  minitest provides a complete suite of testing facilities supporting
69
69
  TDD, BDD, mocking, and benchmarking.
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
187
  requirements: []
188
- rubygems_version: 3.6.3
188
+ rubygems_version: 3.7.2
189
189
  specification_version: 4
190
190
  summary: minitest provides a complete suite of testing facilities supporting TDD,
191
191
  BDD, mocking, and benchmarking
metadata.gz.sig CHANGED
Binary file