minitest 5.0.8 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.txt +10 -0
- data/Manifest.txt +1 -1
- data/README.txt +4 -0
- data/Rakefile +2 -1
- data/lib/minitest.rb +40 -9
- data/lib/minitest/assertions.rb +12 -0
- data/lib/minitest/parallel.rb +40 -0
- data/lib/minitest/spec.rb +1 -1
- data/lib/minitest/test.rb +6 -10
- data/test/minitest/metametameta.rb +4 -2
- data/test/minitest/test_minitest_unit.rb +14 -5
- metadata +68 -86
- metadata.gz.sig +0 -0
- data/lib/minitest/parallel_each.rb +0 -120
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8b0d13fa089e876d7136d72563684a26daf5559c
|
4
|
+
data.tar.gz: b3ad3800b28251404ce824efe8bbdcd3219d2c64
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 87729f6352a71b2fe091a8822eb0765f139ee10b920c8afce63b5c285d60ae983dabfc7eb8acff8df8ffdac3521815c6ba66ae677767c79f8517554c286e6b96
|
7
|
+
data.tar.gz: 86724ca0e04025f5fb697454fd2544db1d68f3d0ece9f2dd86d08e181397dab9c09108d08274c9a8babd6bd7c884afbf4556c7440c72f767befd6d9d6d1e1fb8
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
home :: https://github.com/seattlerb/minitest
|
4
4
|
rdoc :: http://docs.seattlerb.org/minitest
|
5
5
|
vim :: https://github.com/sunaku/vim-ruby-minitest
|
6
|
+
emacs:: https://github.com/arthurnn/minitest-emacs
|
6
7
|
|
7
8
|
== DESCRIPTION:
|
8
9
|
|
@@ -394,6 +395,8 @@ minitest-context :: Defines contexts for code reuse in MiniTest
|
|
394
395
|
minitest-debugger :: Wraps assert so failed assertions drop into
|
395
396
|
the ruby debugger.
|
396
397
|
minitest-display :: Patches MiniTest to allow for an easily configurable output.
|
398
|
+
minitest-doc_reporter :: Detailed output inspired by rspec's documentation
|
399
|
+
format.
|
397
400
|
minitest-emoji :: Print out emoji for your test passes, fails, and skips.
|
398
401
|
minitest-english :: Semantically symmetric aliases for assertions and expectations.
|
399
402
|
minitest-excludes :: Clean API for excluding certain tests you
|
@@ -425,6 +428,7 @@ minitest-spec-context :: Provides rspec-ish context method to MiniTest::Sp
|
|
425
428
|
minitest-spec-expect :: Expect syntax for MiniTest::Spec - expect(sequences).to_include :celery_man
|
426
429
|
minitest-spec-magic :: Minitest::Spec extensions for Rails and beyond
|
427
430
|
minitest-spec-rails :: Drop in MiniTest::Spec superclass for ActiveSupport::TestCase.
|
431
|
+
minitest-stub_any_instance :: Stub any instance of a method on the given class for the duration of a block
|
428
432
|
minitest-stub-const :: Stub constants for the duration of a block
|
429
433
|
minitest-tags :: add tags for minitest
|
430
434
|
minitest-wscolor :: Yet another test colorizer.
|
data/Rakefile
CHANGED
data/lib/minitest.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
require "optparse"
|
2
|
+
require "thread"
|
3
|
+
require "mutex_m"
|
4
|
+
require "minitest/parallel"
|
2
5
|
|
3
6
|
##
|
4
7
|
# :include: README.txt
|
5
8
|
|
6
9
|
module Minitest
|
7
|
-
VERSION = "5.0
|
10
|
+
VERSION = "5.1.0" # :nodoc:
|
8
11
|
|
9
12
|
@@installed_at_exit ||= false
|
10
13
|
@@after_run = []
|
@@ -12,6 +15,12 @@ module Minitest
|
|
12
15
|
|
13
16
|
mc = (class << self; self; end)
|
14
17
|
|
18
|
+
##
|
19
|
+
# Parallel test executor
|
20
|
+
|
21
|
+
mc.send :attr_accessor, :parallel_executor
|
22
|
+
self.parallel_executor = Parallel::Executor.new((ENV['N'] || 2).to_i)
|
23
|
+
|
15
24
|
##
|
16
25
|
# Filter object for backtraces.
|
17
26
|
|
@@ -92,11 +101,13 @@ module Minitest
|
|
92
101
|
#
|
93
102
|
# Minitest.autorun
|
94
103
|
# Minitest.run(args)
|
95
|
-
# __run(reporter, options)
|
104
|
+
# Minitest.__run(reporter, options)
|
96
105
|
# Runnable.runnables.each
|
97
106
|
# runnable.run(reporter, options)
|
98
107
|
# self.runnable_methods.each
|
99
|
-
# self.
|
108
|
+
# self.run_one_method(self, runnable_method, reporter)
|
109
|
+
# Minitest.run_one_method(klass, runnable_method, reporter)
|
110
|
+
# klass.new(runnable_method).run
|
100
111
|
|
101
112
|
def self.run args = []
|
102
113
|
self.load_plugins
|
@@ -113,6 +124,7 @@ module Minitest
|
|
113
124
|
|
114
125
|
reporter.start
|
115
126
|
__run reporter, options
|
127
|
+
self.parallel_executor.shutdown
|
116
128
|
reporter.report
|
117
129
|
|
118
130
|
reporter.passed?
|
@@ -126,9 +138,16 @@ module Minitest
|
|
126
138
|
# loaded if a Runnable calls parallelize_me!.
|
127
139
|
|
128
140
|
def self.__run reporter, options
|
129
|
-
Runnable.runnables
|
130
|
-
|
131
|
-
|
141
|
+
suites = Runnable.runnables
|
142
|
+
parallel, serial = suites.partition { |s| s.test_order == :parallel }
|
143
|
+
|
144
|
+
# If we run the parallel tests before the serial tests, the parallel tests
|
145
|
+
# could run in parallel with the serial tests. This would be bad because
|
146
|
+
# the serial tests won't lock around Reporter#record. Run the serial tests
|
147
|
+
# first, so that after they complete, the parallel tests will lock when
|
148
|
+
# recording results.
|
149
|
+
serial.map { |suite| suite.run reporter, options } +
|
150
|
+
parallel.map { |suite| suite.run reporter, options }
|
132
151
|
end
|
133
152
|
|
134
153
|
def self.process_args args = [] # :nodoc:
|
@@ -265,13 +284,15 @@ module Minitest
|
|
265
284
|
|
266
285
|
with_info_handler reporter do
|
267
286
|
filtered_methods.each do |method_name|
|
268
|
-
|
269
|
-
raise "#{self}#run _must_ return self" unless self === result
|
270
|
-
reporter.record result
|
287
|
+
run_one_method self, method_name, reporter
|
271
288
|
end
|
272
289
|
end
|
273
290
|
end
|
274
291
|
|
292
|
+
def self.run_one_method klass, method_name, reporter
|
293
|
+
reporter.record Minitest.run_one_method(klass, method_name)
|
294
|
+
end
|
295
|
+
|
275
296
|
def self.with_info_handler reporter, &block # :nodoc:
|
276
297
|
handler = lambda do
|
277
298
|
unless reporter.passed? then
|
@@ -369,6 +390,8 @@ module Minitest
|
|
369
390
|
# you want. Go nuts.
|
370
391
|
|
371
392
|
class AbstractReporter
|
393
|
+
include Mutex_m
|
394
|
+
|
372
395
|
##
|
373
396
|
# Starts reporting on the run.
|
374
397
|
|
@@ -408,6 +431,7 @@ module Minitest
|
|
408
431
|
attr_accessor :options
|
409
432
|
|
410
433
|
def initialize io = $stdout, options = {} # :nodoc:
|
434
|
+
super()
|
411
435
|
self.io = io
|
412
436
|
self.options = options
|
413
437
|
end
|
@@ -565,6 +589,7 @@ module Minitest
|
|
565
589
|
attr_accessor :reporters
|
566
590
|
|
567
591
|
def initialize *reporters # :nodoc:
|
592
|
+
super()
|
568
593
|
self.reporters = reporters
|
569
594
|
end
|
570
595
|
|
@@ -729,6 +754,12 @@ module Minitest
|
|
729
754
|
end
|
730
755
|
|
731
756
|
self.backtrace_filter = BacktraceFilter.new
|
757
|
+
|
758
|
+
def self.run_one_method klass, method_name # :nodoc:
|
759
|
+
result = klass.new(method_name).run
|
760
|
+
raise "#{klass}#run _must_ return self" unless klass === result
|
761
|
+
result
|
762
|
+
end
|
732
763
|
end
|
733
764
|
|
734
765
|
require "minitest/test"
|
data/lib/minitest/assertions.rb
CHANGED
@@ -131,6 +131,10 @@ module Minitest
|
|
131
131
|
true
|
132
132
|
end
|
133
133
|
|
134
|
+
def _synchronize # :nodoc:
|
135
|
+
yield
|
136
|
+
end
|
137
|
+
|
134
138
|
##
|
135
139
|
# Fails unless +obj+ is empty.
|
136
140
|
|
@@ -393,6 +397,8 @@ module Minitest
|
|
393
397
|
# that.
|
394
398
|
|
395
399
|
def capture_io
|
400
|
+
_synchronize do
|
401
|
+
begin
|
396
402
|
require 'stringio'
|
397
403
|
|
398
404
|
captured_stdout, captured_stderr = StringIO.new, StringIO.new
|
@@ -406,6 +412,8 @@ module Minitest
|
|
406
412
|
ensure
|
407
413
|
$stdout = orig_stdout
|
408
414
|
$stderr = orig_stderr
|
415
|
+
end
|
416
|
+
end
|
409
417
|
end
|
410
418
|
|
411
419
|
##
|
@@ -424,6 +432,8 @@ module Minitest
|
|
424
432
|
# only use it when you need to test the output of a subprocess.
|
425
433
|
|
426
434
|
def capture_subprocess_io
|
435
|
+
_synchronize do
|
436
|
+
begin
|
427
437
|
require 'tempfile'
|
428
438
|
|
429
439
|
captured_stdout, captured_stderr = Tempfile.new("out"), Tempfile.new("err")
|
@@ -443,6 +453,8 @@ module Minitest
|
|
443
453
|
captured_stderr.unlink
|
444
454
|
$stdout.reopen orig_stdout
|
445
455
|
$stderr.reopen orig_stderr
|
456
|
+
end
|
457
|
+
end
|
446
458
|
end
|
447
459
|
|
448
460
|
##
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Minitest
|
2
|
+
module Parallel
|
3
|
+
class Executor
|
4
|
+
attr_reader :size
|
5
|
+
|
6
|
+
def initialize size
|
7
|
+
@size = size
|
8
|
+
@queue = Queue.new
|
9
|
+
@pool = size.times.map {
|
10
|
+
Thread.new(@queue) do |queue|
|
11
|
+
Thread.current.abort_on_exception = true
|
12
|
+
while job = queue.pop
|
13
|
+
klass, method, reporter = job
|
14
|
+
result = Minitest.run_one_method klass, method
|
15
|
+
reporter.synchronize { reporter.record result }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
def << work; @queue << work; end
|
22
|
+
|
23
|
+
def shutdown
|
24
|
+
size.times { @queue << nil }
|
25
|
+
@pool.each(&:join)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
module Test
|
30
|
+
def _synchronize; Test.io_lock.synchronize { yield }; end
|
31
|
+
|
32
|
+
module ClassMethods
|
33
|
+
def run_one_method klass, method_name, reporter
|
34
|
+
MiniTest.parallel_executor << [klass, method_name, reporter]
|
35
|
+
end
|
36
|
+
def test_order; :parallel; end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/minitest/spec.rb
CHANGED
@@ -197,7 +197,7 @@ class Minitest::Spec < Minitest::Test
|
|
197
197
|
#
|
198
198
|
# This is also aliased to #specify and doesn't require a +desc+ arg.
|
199
199
|
#
|
200
|
-
# Hint: If you _do_ want
|
200
|
+
# Hint: If you _do_ want inheritance, use minitest/test. You can mix
|
201
201
|
# and match between assertions and expectations as much as you want.
|
202
202
|
|
203
203
|
def it desc = "anonymous", &block
|
data/lib/minitest/test.rb
CHANGED
@@ -14,6 +14,9 @@ module Minitest
|
|
14
14
|
PASSTHROUGH_EXCEPTIONS = [NoMemoryError, SignalException, # :nodoc:
|
15
15
|
Interrupt, SystemExit]
|
16
16
|
|
17
|
+
class << self; attr_accessor :io_lock; end
|
18
|
+
self.io_lock = Mutex.new
|
19
|
+
|
17
20
|
##
|
18
21
|
# Call this at the top of your tests when you absolutely
|
19
22
|
# positively need to have ordered tests. In doing so, you're
|
@@ -46,12 +49,8 @@ module Minitest
|
|
46
49
|
# and your tests are awesome.
|
47
50
|
|
48
51
|
def self.parallelize_me!
|
49
|
-
|
50
|
-
|
51
|
-
class << self
|
52
|
-
undef_method :test_order if method_defined? :test_order
|
53
|
-
define_method :test_order do :parallel end
|
54
|
-
end
|
52
|
+
include Minitest::Parallel::Test
|
53
|
+
extend Minitest::Parallel::Test::ClassMethods
|
55
54
|
end
|
56
55
|
|
57
56
|
##
|
@@ -63,10 +62,7 @@ module Minitest
|
|
63
62
|
methods = methods_matching(/^test_/)
|
64
63
|
|
65
64
|
case self.test_order
|
66
|
-
when :parallel
|
67
|
-
max = methods.size
|
68
|
-
ParallelEach.new methods.sort.sort_by { rand max }
|
69
|
-
when :random then
|
65
|
+
when :random, :parallel then
|
70
66
|
max = methods.size
|
71
67
|
methods.sort.sort_by { rand max }
|
72
68
|
when :alpha, :sorted then
|
@@ -22,6 +22,8 @@ class MetaMetaMetaTestCase < Minitest::Test
|
|
22
22
|
|
23
23
|
reporter.start
|
24
24
|
|
25
|
+
yield(reporter) if block_given?
|
26
|
+
|
25
27
|
@tus ||= [@tu]
|
26
28
|
@tus.each do |tu|
|
27
29
|
Minitest::Runnable.runnables.delete tu
|
@@ -36,7 +38,7 @@ class MetaMetaMetaTestCase < Minitest::Test
|
|
36
38
|
reporter.reporters.first
|
37
39
|
end
|
38
40
|
|
39
|
-
def assert_report expected, flags = %w[--seed 42]
|
41
|
+
def assert_report expected, flags = %w[--seed 42], &block
|
40
42
|
header = clean <<-EOM
|
41
43
|
Run options: #{flags.map { |s| s =~ /\|/ ? s.inspect : s }.join " "}
|
42
44
|
|
@@ -44,7 +46,7 @@ class MetaMetaMetaTestCase < Minitest::Test
|
|
44
46
|
|
45
47
|
EOM
|
46
48
|
|
47
|
-
run_tu_with_fresh_reporter flags
|
49
|
+
run_tu_with_fresh_reporter flags, &block
|
48
50
|
|
49
51
|
output = normalize_output @output.string.dup
|
50
52
|
|
@@ -490,15 +490,12 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
490
490
|
end
|
491
491
|
end
|
492
492
|
|
493
|
-
def test_parallel_each_size
|
494
|
-
assert_equal 0, Minitest::ParallelEach.new([]).size
|
495
|
-
end
|
496
|
-
|
497
493
|
def test_run_parallel
|
498
494
|
skip "I don't have ParallelEach debugged yet" if maglev?
|
499
495
|
|
500
496
|
test_count = 2
|
501
497
|
test_latch = Latch.new test_count
|
498
|
+
wait_latch = Latch.new test_count
|
502
499
|
main_latch = Latch.new
|
503
500
|
|
504
501
|
thread = Thread.new {
|
@@ -537,7 +534,19 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
537
534
|
2 runs, 2 assertions, 0 failures, 0 errors, 0 skips
|
538
535
|
EOM
|
539
536
|
|
540
|
-
assert_report
|
537
|
+
assert_report(expected) do |reporter|
|
538
|
+
reporter.extend(Module.new {
|
539
|
+
define_method("record") do |result|
|
540
|
+
super(result)
|
541
|
+
wait_latch.release
|
542
|
+
end
|
543
|
+
|
544
|
+
define_method("report") do
|
545
|
+
wait_latch.await
|
546
|
+
super()
|
547
|
+
end
|
548
|
+
})
|
549
|
+
end
|
541
550
|
assert thread.join
|
542
551
|
end
|
543
552
|
end
|
metadata
CHANGED
@@ -1,19 +1,13 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 5
|
8
|
-
- 0
|
9
|
-
- 8
|
10
|
-
version: 5.0.8
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 5.1.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Ryan Davis
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
|
-
cert_chain:
|
10
|
+
cert_chain:
|
17
11
|
- |
|
18
12
|
-----BEGIN CERTIFICATE-----
|
19
13
|
MIIDPjCCAiagAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
|
@@ -35,104 +29,99 @@ cert_chain:
|
|
35
29
|
Y4evBVezr3SjXz08vPqRO5YRdO3zfeMT8gBjRqZjWJGMZ2lD4XNfrs7eky74CyZw
|
36
30
|
xx3n58i0lQkBE1EpKE0lFu/y
|
37
31
|
-----END CERTIFICATE-----
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
- !ruby/object:Gem::Dependency
|
32
|
+
date: 2013-12-06 00:00:00.000000000 Z
|
33
|
+
dependencies:
|
34
|
+
- !ruby/object:Gem::Dependency
|
42
35
|
name: rdoc
|
43
|
-
|
44
|
-
|
45
|
-
none: false
|
46
|
-
requirements:
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
47
38
|
- - ~>
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
|
50
|
-
segments:
|
51
|
-
- 4
|
52
|
-
- 0
|
53
|
-
version: "4.0"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '4.0'
|
54
41
|
type: :development
|
55
|
-
version_requirements: *id001
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: hoe
|
58
42
|
prerelease: false
|
59
|
-
|
60
|
-
|
61
|
-
requirements:
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
62
45
|
- - ~>
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.0'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: hoe
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.7'
|
69
55
|
type: :development
|
70
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.7'
|
71
62
|
description: |-
|
72
63
|
minitest provides a complete suite of testing facilities supporting
|
73
64
|
TDD, BDD, mocking, and benchmarking.
|
74
|
-
|
65
|
+
|
75
66
|
"I had a class with Jim Weirich on testing last week and we were
|
76
67
|
allowed to choose our testing frameworks. Kirk Haines and I were
|
77
68
|
paired up and we cracked open the code for a few test
|
78
69
|
frameworks...
|
79
|
-
|
70
|
+
|
80
71
|
I MUST say that minitest is *very* readable / understandable
|
81
72
|
compared to the 'other two' options we looked at. Nicely done and
|
82
73
|
thank you for helping us keep our mental sanity."
|
83
|
-
|
74
|
+
|
84
75
|
-- Wayne E. Seguin
|
85
|
-
|
76
|
+
|
86
77
|
minitest/unit is a small and incredibly fast unit testing framework.
|
87
78
|
It provides a rich set of assertions to make your tests clean and
|
88
79
|
readable.
|
89
|
-
|
80
|
+
|
90
81
|
minitest/spec is a functionally complete spec engine. It hooks onto
|
91
82
|
minitest/unit and seamlessly bridges test assertions over to spec
|
92
83
|
expectations.
|
93
|
-
|
84
|
+
|
94
85
|
minitest/benchmark is an awesome way to assert the performance of your
|
95
86
|
algorithms in a repeatable manner. Now you can assert that your newb
|
96
87
|
co-worker doesn't replace your linear algorithm with an exponential
|
97
88
|
one!
|
98
|
-
|
89
|
+
|
99
90
|
minitest/mock by Steven Baker, is a beautifully tiny mock (and stub)
|
100
91
|
object framework.
|
101
|
-
|
92
|
+
|
102
93
|
minitest/pride shows pride in testing and adds coloring to your test
|
103
94
|
output. I guess it is an example of how to write IO pipes too. :P
|
104
|
-
|
95
|
+
|
105
96
|
minitest/unit is meant to have a clean implementation for language
|
106
97
|
implementors that need a minimal set of methods to bootstrap a working
|
107
98
|
test suite. For example, there is no magic involved for test-case
|
108
99
|
discovery.
|
109
|
-
|
100
|
+
|
110
101
|
"Again, I can't praise enough the idea of a testing/specing
|
111
102
|
framework that I can actually read in full in one sitting!"
|
112
|
-
|
103
|
+
|
113
104
|
-- Piotr Szotkowski
|
114
|
-
|
105
|
+
|
115
106
|
Comparing to rspec:
|
116
|
-
|
107
|
+
|
117
108
|
rspec is a testing DSL. minitest is ruby.
|
118
|
-
|
109
|
+
|
119
110
|
-- Adam Hawkins, "Bow Before MiniTest"
|
120
|
-
|
111
|
+
|
121
112
|
minitest doesn't reinvent anything that ruby already provides, like:
|
122
113
|
classes, modules, inheritance, methods. This means you only have to
|
123
114
|
learn ruby to use minitest and all of your regular OO practices like
|
124
115
|
extract-method refactorings still apply.
|
125
|
-
email:
|
116
|
+
email:
|
126
117
|
- ryand-ruby@zenspider.com
|
127
118
|
executables: []
|
128
|
-
|
129
119
|
extensions: []
|
130
|
-
|
131
|
-
extra_rdoc_files:
|
120
|
+
extra_rdoc_files:
|
132
121
|
- History.txt
|
133
122
|
- Manifest.txt
|
134
123
|
- README.txt
|
135
|
-
files:
|
124
|
+
files:
|
136
125
|
- .autotest
|
137
126
|
- History.txt
|
138
127
|
- Manifest.txt
|
@@ -147,7 +136,7 @@ files:
|
|
147
136
|
- lib/minitest/expectations.rb
|
148
137
|
- lib/minitest/hell.rb
|
149
138
|
- lib/minitest/mock.rb
|
150
|
-
- lib/minitest/
|
139
|
+
- lib/minitest/parallel.rb
|
151
140
|
- lib/minitest/pride.rb
|
152
141
|
- lib/minitest/pride_plugin.rb
|
153
142
|
- lib/minitest/spec.rb
|
@@ -161,40 +150,33 @@ files:
|
|
161
150
|
- test/minitest/test_minitest_unit.rb
|
162
151
|
- .gemtest
|
163
152
|
homepage: https://github.com/seattlerb/minitest
|
164
|
-
licenses:
|
153
|
+
licenses:
|
165
154
|
- MIT
|
155
|
+
metadata: {}
|
166
156
|
post_install_message:
|
167
|
-
rdoc_options:
|
157
|
+
rdoc_options:
|
168
158
|
- --main
|
169
159
|
- README.txt
|
170
|
-
require_paths:
|
160
|
+
require_paths:
|
171
161
|
- lib
|
172
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
none: false
|
183
|
-
requirements:
|
184
|
-
- - ">="
|
185
|
-
- !ruby/object:Gem::Version
|
186
|
-
hash: 3
|
187
|
-
segments:
|
188
|
-
- 0
|
189
|
-
version: "0"
|
162
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - '>='
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '0'
|
190
172
|
requirements: []
|
191
|
-
|
192
|
-
|
193
|
-
rubygems_version: 1.8.25
|
173
|
+
rubyforge_project: minitest
|
174
|
+
rubygems_version: 2.1.10
|
194
175
|
signing_key:
|
195
|
-
specification_version:
|
196
|
-
summary: minitest provides a complete suite of testing facilities supporting TDD,
|
197
|
-
|
176
|
+
specification_version: 4
|
177
|
+
summary: minitest provides a complete suite of testing facilities supporting TDD,
|
178
|
+
BDD, mocking, and benchmarking
|
179
|
+
test_files:
|
198
180
|
- test/minitest/test_minitest_benchmark.rb
|
199
181
|
- test/minitest/test_minitest_mock.rb
|
200
182
|
- test/minitest/test_minitest_reporter.rb
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,120 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# Provides a parallel #each that lets you enumerate using N threads.
|
3
|
-
# Use environment variable N to customize. Defaults to 2. Enumerable,
|
4
|
-
# so all the goodies come along (tho not all are wrapped yet to
|
5
|
-
# return another ParallelEach instance).
|
6
|
-
|
7
|
-
class Minitest::ParallelEach
|
8
|
-
require 'thread'
|
9
|
-
include Enumerable
|
10
|
-
|
11
|
-
##
|
12
|
-
# How many Threads to use for this parallel #each.
|
13
|
-
|
14
|
-
N = (ENV['N'] || 2).to_i
|
15
|
-
|
16
|
-
##
|
17
|
-
# Create a new ParallelEach instance over +list+.
|
18
|
-
|
19
|
-
def initialize list
|
20
|
-
@queue = Queue.new # *sigh*... the Queue api sucks sooo much...
|
21
|
-
|
22
|
-
list.each { |i| @queue << i }
|
23
|
-
N.times { @queue << nil }
|
24
|
-
end
|
25
|
-
|
26
|
-
def select(&block) # :nodoc:
|
27
|
-
self.class.new super
|
28
|
-
end
|
29
|
-
|
30
|
-
alias find_all select # :nodoc:
|
31
|
-
|
32
|
-
##
|
33
|
-
# Starts N threads that yield each element to your block. Joins the
|
34
|
-
# threads at the end.
|
35
|
-
|
36
|
-
def each
|
37
|
-
threads = N.times.map {
|
38
|
-
Thread.new do
|
39
|
-
Thread.current.abort_on_exception = true
|
40
|
-
while job = @queue.pop
|
41
|
-
yield job
|
42
|
-
end
|
43
|
-
end
|
44
|
-
}
|
45
|
-
threads.map(&:join)
|
46
|
-
end
|
47
|
-
|
48
|
-
def count # :nodoc:
|
49
|
-
[@queue.size - N, 0].max
|
50
|
-
end
|
51
|
-
|
52
|
-
alias_method :size, :count # :nodoc:
|
53
|
-
end
|
54
|
-
|
55
|
-
module Minitest
|
56
|
-
class << self
|
57
|
-
remove_method :__run
|
58
|
-
end
|
59
|
-
|
60
|
-
class Test
|
61
|
-
@mutex = Mutex.new
|
62
|
-
|
63
|
-
def self.synchronize # :nodoc:
|
64
|
-
if @mutex then # see parallel_each.rb
|
65
|
-
@mutex.synchronize { yield }
|
66
|
-
else
|
67
|
-
yield
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
alias :simple_capture_io :capture_io
|
72
|
-
|
73
|
-
def capture_io(&b)
|
74
|
-
Test.synchronize do
|
75
|
-
simple_capture_io(&b)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
alias :simple_capture_subprocess_io :capture_subprocess_io
|
80
|
-
|
81
|
-
def capture_subprocess_io(&b)
|
82
|
-
Test.synchronize do
|
83
|
-
simple_capture_subprocess_io(&b)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
class Reporter
|
89
|
-
@mutex = Mutex.new
|
90
|
-
|
91
|
-
def self.synchronize # :nodoc:
|
92
|
-
if @mutex then # see parallel_each.rb
|
93
|
-
@mutex.synchronize { yield }
|
94
|
-
else
|
95
|
-
yield
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
alias :simple_record :record
|
100
|
-
|
101
|
-
def record result
|
102
|
-
Reporter.synchronize do
|
103
|
-
simple_record result
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
##
|
109
|
-
# Runs all the +suites+ for a given +type+. Runs suites declaring
|
110
|
-
# a test_order of +:parallel+ in parallel, and everything else
|
111
|
-
# serial.
|
112
|
-
|
113
|
-
def self.__run reporter, options
|
114
|
-
suites = Runnable.runnables
|
115
|
-
parallel, serial = suites.partition { |s| s.test_order == :parallel }
|
116
|
-
|
117
|
-
ParallelEach.new(parallel).map { |suite| suite.run reporter, options } +
|
118
|
-
serial.map { |suite| suite.run reporter, options }
|
119
|
-
end
|
120
|
-
end
|