minitest 5.18.0 → 5.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +25 -0
- data/README.rdoc +10 -9
- data/lib/minitest/test.rb +2 -10
- data/lib/minitest/test_task.rb +4 -7
- data/lib/minitest.rb +57 -14
- data/test/minitest/test_minitest_reporter.rb +29 -0
- data/test/minitest/test_minitest_test.rb +12 -2
- data.tar.gz.sig +4 -1
- metadata +6 -6
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 667a803a272949e7b05440f91a56155ea3977a5b9d364542801889c5a2fe0ff0
|
4
|
+
data.tar.gz: 862bf0ff3d24eea4bbe6c7f435ceef19aaa97748f6a87ec3fa51dc218ca79298
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2284c84ae5f98a3454e9a95417e609ca1a8ef9af8ee8b1fad8f2aca2632fde6a309e266ef1d399d9a7d47337cdcba696500a1b36f1fa7d952615eb390a89e329
|
7
|
+
data.tar.gz: a76204f74c2caf693a4302065815b871863ae655372d25fc4d41e416b0d4935704c1e1068457b5cda934312e3915ae8a27595ca962c98e544dd45b54cac2aef7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
@@ -1,3 +1,28 @@
|
|
1
|
+
=== 5.20.0 / 2023-09-06
|
2
|
+
|
3
|
+
* 1 minor enhancement:
|
4
|
+
|
5
|
+
* Optionally allow autorun exit hook to remain active in forked child. (casperisfine)
|
6
|
+
|
7
|
+
=== 5.19.0 / 2023-07-26
|
8
|
+
|
9
|
+
* 2 minor enhancements:
|
10
|
+
|
11
|
+
* Add metadata lazy accessor to Runnable / Result. (matteeyah)
|
12
|
+
* Only load minitest/unit (aka ancient MiniTest compatibility layer) if ENV["MT_COMPAT"]
|
13
|
+
|
14
|
+
* 1 bug fix:
|
15
|
+
|
16
|
+
* Minitest::TestTask enthusiastically added itself to default. (ParadoxV5)
|
17
|
+
|
18
|
+
=== 5.18.1 / 2023-06-16
|
19
|
+
|
20
|
+
* 3 bug fixes:
|
21
|
+
|
22
|
+
* Avoid extra string allocations when filtering tests. (tenderlove)
|
23
|
+
* Only mention deprecated ENV['N'] if it is an integer string.
|
24
|
+
* Push up test_order to Minitest::Runnable to fix minitest/hell. (koic)
|
25
|
+
|
1
26
|
=== 5.18.0 / 2023-03-04
|
2
27
|
|
3
28
|
* 2 major enhancements:
|
data/README.rdoc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= minitest/{test,spec,mock,benchmark}
|
2
2
|
|
3
|
-
home :: https://github.com/
|
4
|
-
bugs :: https://github.com/
|
3
|
+
home :: https://github.com/minitest/minitest
|
4
|
+
bugs :: https://github.com/minitest/minitest/issues
|
5
5
|
rdoc :: https://docs.seattlerb.org/minitest
|
6
6
|
vim :: https://github.com/sunaku/vim-ruby-minitest
|
7
7
|
emacs:: https://github.com/arthurnn/minitest-emacs
|
@@ -411,7 +411,7 @@ supporting versions of ruby that are long past EOL. Hopefully I'll be
|
|
411
411
|
able to support only current versions of ruby sometime in the near
|
412
412
|
future.
|
413
413
|
|
414
|
-
(As of
|
414
|
+
(As of 2023-03-05)
|
415
415
|
|
416
416
|
Current versions of rails: (https://endoflife.date/rails)
|
417
417
|
|
@@ -422,20 +422,21 @@ Current versions of rails: (https://endoflife.date/rails)
|
|
422
422
|
| 6.0 | >= 2.5 | 2.6 | >= 5.1 | Security | 2023-06-01 |
|
423
423
|
| 5.2 | >= 2.2.2 | 2.5 | ~> 5.1 | EOL | 2022-06-01 |
|
424
424
|
|
425
|
+
If you want to look at the requirements for a specific version, run:
|
426
|
+
|
427
|
+
gem spec -r --ruby rails -v 7.0.0
|
428
|
+
|
425
429
|
Current versions of ruby: (https://endoflife.date/ruby)
|
426
430
|
|
427
431
|
| ruby | Status | EOL Date |
|
428
432
|
|------+---------+------------|
|
429
|
-
| 3.
|
433
|
+
| 3.2 | Current | 2026-03-31 |
|
434
|
+
| 3.1 | Maint | 2025-03-31 |
|
430
435
|
| 3.0 | Maint | 2024-03-31 |
|
431
|
-
| 2.7 |
|
436
|
+
| 2.7 | Security| 2023-03-31 |
|
432
437
|
| 2.6 | EOL | 2022-03-31 |
|
433
438
|
| 2.5 | EOL | 2021-03-31 |
|
434
439
|
|
435
|
-
See also:
|
436
|
-
|
437
|
-
* https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
|
438
|
-
|
439
440
|
=== How to test SimpleDelegates?
|
440
441
|
|
441
442
|
The following implementation and test:
|
data/lib/minitest/test.rb
CHANGED
@@ -80,14 +80,6 @@ module Minitest
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
##
|
84
|
-
# Defines the order to run tests (:random by default). Override
|
85
|
-
# this or use a convenience method to change it for your tests.
|
86
|
-
|
87
|
-
def self.test_order
|
88
|
-
:random
|
89
|
-
end
|
90
|
-
|
91
83
|
##
|
92
84
|
# Runs a single test with setup/teardown hooks.
|
93
85
|
|
@@ -149,7 +141,7 @@ module Minitest
|
|
149
141
|
# end
|
150
142
|
# end
|
151
143
|
#
|
152
|
-
# class
|
144
|
+
# class Minitest::Test
|
153
145
|
# include MyMinitestPlugin
|
154
146
|
# end
|
155
147
|
|
@@ -253,4 +245,4 @@ module Minitest
|
|
253
245
|
end # Test
|
254
246
|
end
|
255
247
|
|
256
|
-
require "minitest/unit"
|
248
|
+
require "minitest/unit" if ENV["MT_COMPAT"] # compatibility layer only
|
data/lib/minitest/test_task.rb
CHANGED
@@ -29,6 +29,10 @@ module Minitest # :nodoc:
|
|
29
29
|
# end
|
30
30
|
#
|
31
31
|
# Customize the name and only run unit tests.
|
32
|
+
#
|
33
|
+
# NOTE: To hook this task up to the default, make it a dependency:
|
34
|
+
#
|
35
|
+
# task default: :unit
|
32
36
|
|
33
37
|
class TestTask < Rake::TaskLib
|
34
38
|
WINDOWS = RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ # :nodoc:
|
@@ -157,8 +161,6 @@ module Minitest # :nodoc:
|
|
157
161
|
end
|
158
162
|
|
159
163
|
def define # :nodoc:
|
160
|
-
default_tasks = []
|
161
|
-
|
162
164
|
desc "Run the test suite. Use N, X, A, and TESTOPTS to add flags/args."
|
163
165
|
task name do
|
164
166
|
ruby make_test_cmd, verbose:verbose
|
@@ -243,11 +245,6 @@ module Minitest # :nodoc:
|
|
243
245
|
"sort -n -k2 -t=",
|
244
246
|
"tail -25"].join " | "
|
245
247
|
end
|
246
|
-
|
247
|
-
default_tasks << name
|
248
|
-
|
249
|
-
desc "Run the default task(s)."
|
250
|
-
task :default => default_tasks
|
251
248
|
end
|
252
249
|
|
253
250
|
##
|
data/lib/minitest.rb
CHANGED
@@ -9,7 +9,7 @@ require "etc"
|
|
9
9
|
# :include: README.rdoc
|
10
10
|
|
11
11
|
module Minitest
|
12
|
-
VERSION = "5.
|
12
|
+
VERSION = "5.20.0" # :nodoc:
|
13
13
|
|
14
14
|
@@installed_at_exit ||= false
|
15
15
|
@@after_run = []
|
@@ -32,7 +32,7 @@ module Minitest
|
|
32
32
|
|
33
33
|
cattr_accessor :parallel_executor
|
34
34
|
|
35
|
-
warn "DEPRECATED: use MT_CPU instead of N for parallel test runs" if ENV["N"]
|
35
|
+
warn "DEPRECATED: use MT_CPU instead of N for parallel test runs" if ENV["N"] && ENV["N"].to_i > 0
|
36
36
|
n_threads = (ENV["MT_CPU"] || ENV["N"] || Etc.nprocessors).to_i
|
37
37
|
|
38
38
|
self.parallel_executor = Parallel::Executor.new n_threads
|
@@ -60,6 +60,9 @@ module Minitest
|
|
60
60
|
cattr_accessor :info_signal
|
61
61
|
self.info_signal = "INFO"
|
62
62
|
|
63
|
+
cattr_accessor :allow_fork
|
64
|
+
self.allow_fork = false
|
65
|
+
|
63
66
|
##
|
64
67
|
# Registers Minitest to run at process exit
|
65
68
|
|
@@ -75,7 +78,7 @@ module Minitest
|
|
75
78
|
|
76
79
|
pid = Process.pid
|
77
80
|
at_exit {
|
78
|
-
next if Process.pid != pid
|
81
|
+
next if !Minitest.allow_fork && Process.pid != pid
|
79
82
|
@@after_run.reverse_each(&:call)
|
80
83
|
exit exit_code || false
|
81
84
|
}
|
@@ -331,19 +334,25 @@ module Minitest
|
|
331
334
|
# reporter to record.
|
332
335
|
|
333
336
|
def self.run reporter, options = {}
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
337
|
+
filtered_methods = if options[:filter]
|
338
|
+
filter = options[:filter]
|
339
|
+
filter = Regexp.new $1 if filter.is_a?(String) && filter =~ %r%/(.*)/%
|
340
|
+
|
341
|
+
self.runnable_methods.find_all { |m|
|
342
|
+
filter === m || filter === "#{self}##{m}"
|
343
|
+
}
|
344
|
+
else
|
345
|
+
self.runnable_methods
|
346
|
+
end
|
340
347
|
|
341
|
-
|
342
|
-
|
348
|
+
if options[:exclude]
|
349
|
+
exclude = options[:exclude]
|
350
|
+
exclude = Regexp.new $1 if exclude =~ %r%/(.*)/%
|
343
351
|
|
344
|
-
|
345
|
-
|
346
|
-
|
352
|
+
filtered_methods.delete_if { |m|
|
353
|
+
exclude === m || exclude === "#{self}##{m}"
|
354
|
+
}
|
355
|
+
end
|
347
356
|
|
348
357
|
return if filtered_methods.empty?
|
349
358
|
|
@@ -365,6 +374,14 @@ module Minitest
|
|
365
374
|
reporter.record Minitest.run_one_method(klass, method_name)
|
366
375
|
end
|
367
376
|
|
377
|
+
##
|
378
|
+
# Defines the order to run tests (:random by default). Override
|
379
|
+
# this or use a convenience method to change it for your tests.
|
380
|
+
|
381
|
+
def self.test_order
|
382
|
+
:random
|
383
|
+
end
|
384
|
+
|
368
385
|
def self.with_info_handler reporter, &block # :nodoc:
|
369
386
|
handler = lambda do
|
370
387
|
unless reporter.passed? then
|
@@ -432,6 +449,31 @@ module Minitest
|
|
432
449
|
self.name = name
|
433
450
|
self.failures = []
|
434
451
|
self.assertions = 0
|
452
|
+
# lazy initializer for metadata
|
453
|
+
end
|
454
|
+
|
455
|
+
##
|
456
|
+
# Metadata you attach to the test results that get sent to the reporter.
|
457
|
+
#
|
458
|
+
# Lazily initializes to a hash, to keep memory down.
|
459
|
+
#
|
460
|
+
# NOTE: this data *must* be plain (read: marshal-able) data!
|
461
|
+
# Hashes! Arrays! Strings!
|
462
|
+
|
463
|
+
def metadata
|
464
|
+
@metadata ||= {}
|
465
|
+
end
|
466
|
+
|
467
|
+
##
|
468
|
+
# Sets metadata, mainly used for +Result.from+.
|
469
|
+
|
470
|
+
attr_writer :metadata
|
471
|
+
|
472
|
+
##
|
473
|
+
# Returns true if metadata exists.
|
474
|
+
|
475
|
+
def metadata?
|
476
|
+
defined? @metadata
|
435
477
|
end
|
436
478
|
|
437
479
|
##
|
@@ -552,6 +594,7 @@ module Minitest
|
|
552
594
|
r.assertions = o.assertions
|
553
595
|
r.failures = o.failures.dup
|
554
596
|
r.time = o.time
|
597
|
+
r.metadata = o.metadata if o.metadata?
|
555
598
|
|
556
599
|
r.source_location = o.method(o.name).source_location rescue ["unknown", -1]
|
557
600
|
|
@@ -65,6 +65,12 @@ class TestMinitestReporter < MetaMetaMetaTestCase
|
|
65
65
|
@pt ||= Minitest::Result.from Minitest::Test.new(:woot)
|
66
66
|
end
|
67
67
|
|
68
|
+
def passing_test_with_metadata
|
69
|
+
test = Minitest::Test.new(:woot)
|
70
|
+
test.metadata[:meta] = :data
|
71
|
+
@pt ||= Minitest::Result.from test
|
72
|
+
end
|
73
|
+
|
68
74
|
def skip_test
|
69
75
|
unless defined? @st then
|
70
76
|
@st = Minitest::Test.new(:woot)
|
@@ -166,6 +172,29 @@ class TestMinitestReporter < MetaMetaMetaTestCase
|
|
166
172
|
assert_equal 0, r.assertions
|
167
173
|
end
|
168
174
|
|
175
|
+
def test_record_pass_with_metadata
|
176
|
+
reporter = self.r
|
177
|
+
|
178
|
+
def reporter.metadata
|
179
|
+
@metadata
|
180
|
+
end
|
181
|
+
|
182
|
+
def reporter.record result
|
183
|
+
super
|
184
|
+
@metadata = result.metadata if result.metadata?
|
185
|
+
end
|
186
|
+
|
187
|
+
r.record passing_test_with_metadata
|
188
|
+
|
189
|
+
exp = { :meta => :data }
|
190
|
+
assert_equal exp, reporter.metadata
|
191
|
+
|
192
|
+
assert_equal ".", io.string
|
193
|
+
assert_empty r.results
|
194
|
+
assert_equal 1, r.count
|
195
|
+
assert_equal 0, r.assertions
|
196
|
+
end
|
197
|
+
|
169
198
|
def test_record_fail
|
170
199
|
fail_test = self.fail_test
|
171
200
|
r.record fail_test
|
@@ -1089,17 +1089,27 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
1089
1089
|
|
1090
1090
|
def test_autorun_does_not_affect_fork_success_status
|
1091
1091
|
@assertion_count = 0
|
1092
|
-
skip "windows doesn't have
|
1092
|
+
skip "windows doesn't have fork" unless Process.respond_to?(:fork)
|
1093
1093
|
Process.waitpid(fork {})
|
1094
1094
|
assert_equal true, $?.success?
|
1095
1095
|
end
|
1096
1096
|
|
1097
1097
|
def test_autorun_does_not_affect_fork_exit_status
|
1098
1098
|
@assertion_count = 0
|
1099
|
-
skip "windows doesn't have
|
1099
|
+
skip "windows doesn't have fork" unless Process.respond_to?(:fork)
|
1100
1100
|
Process.waitpid(fork { exit 42 })
|
1101
1101
|
assert_equal 42, $?.exitstatus
|
1102
1102
|
end
|
1103
|
+
|
1104
|
+
def test_autorun_optionally_can_affect_fork_exit_status
|
1105
|
+
@assertion_count = 0
|
1106
|
+
skip "windows doesn't have fork" unless Process.respond_to?(:fork)
|
1107
|
+
Minitest.allow_fork = true
|
1108
|
+
Process.waitpid(fork { exit 42 })
|
1109
|
+
refute_equal 42, $?.exitstatus
|
1110
|
+
ensure
|
1111
|
+
Minitest.allow_fork = false
|
1112
|
+
end
|
1103
1113
|
end
|
1104
1114
|
|
1105
1115
|
class TestMinitestGuard < Minitest::Test
|
data.tar.gz.sig
CHANGED
@@ -1 +1,4 @@
|
|
1
|
-
|
1
|
+
^�bG�@�����Ąw��nr��:@�
|
2
|
+
���Q���%�`d�[M�S7#�N�Ǟ,sVn=5��ݕ��0+E$��0���K�Kn80br�
|
3
|
+
�ʜ�}�� ���m�O��i
|
4
|
+
��=
|
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.
|
4
|
+
version: 5.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
ROfWo9Uyp8ba/j9eVG14KkYRaLydAY1MNQk2yd3R5CGfeOpD1kttxjoypoUJ2dOG
|
30
30
|
nsNBRuQJ1UfiCG97a6DNm+Fr
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2023-
|
32
|
+
date: 2023-09-06 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rdoc
|
@@ -157,12 +157,12 @@ files:
|
|
157
157
|
- test/minitest/test_minitest_spec.rb
|
158
158
|
- test/minitest/test_minitest_test.rb
|
159
159
|
- test/minitest/test_minitest_test_task.rb
|
160
|
-
homepage: https://github.com/
|
160
|
+
homepage: https://github.com/minitest/minitest
|
161
161
|
licenses:
|
162
162
|
- MIT
|
163
163
|
metadata:
|
164
|
-
homepage_uri: https://github.com/
|
165
|
-
bug_tracker_uri: https://github.com/
|
164
|
+
homepage_uri: https://github.com/minitest/minitest
|
165
|
+
bug_tracker_uri: https://github.com/minitest/minitest/issues
|
166
166
|
post_install_message:
|
167
167
|
rdoc_options:
|
168
168
|
- "--main"
|
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
183
|
- !ruby/object:Gem::Version
|
184
184
|
version: '0'
|
185
185
|
requirements: []
|
186
|
-
rubygems_version: 3.4.
|
186
|
+
rubygems_version: 3.4.10
|
187
187
|
signing_key:
|
188
188
|
specification_version: 4
|
189
189
|
summary: minitest provides a complete suite of testing facilities supporting TDD,
|
metadata.gz.sig
CHANGED
Binary file
|