minitest-parallel_fork 1.2.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c152ef9216b8cbc9700f7f7e0281847695b325e660b51268b0d148a44e5aba2
4
- data.tar.gz: 9d0739abeb8ccfaeb0ed023cb75b4fe30bb3f6e509af6d952204042229356649
3
+ metadata.gz: bdbf96cdc1b208955148ed3e6ccba3d93542785b6e0c628a9b73acad4bcc0614
4
+ data.tar.gz: 18a0e8ed8d41d9c2d36d8927939d3b8865264b363df7194fefe1cb8238cecac3
5
5
  SHA512:
6
- metadata.gz: e075bac95ab8dd13987e59533ace22ff48d878db63399659764f7af6c553cf835282b39044b50592ec776ab5ebc2d1af095bc9d8df955c0b230cce3cfe58a2e3
7
- data.tar.gz: 57448ca69342f474102377fb287c67d298db98147bef22450d721cdae0acc4e9f65aad7d3e3937fc834118fd10e6200ced55d04609bc7ac43527dc1d6b63f5c7
6
+ metadata.gz: 874cd2b108f8f52135e6ea193dd5bb46b9416247dafab76e135a02456cc456a499c05f140aca081b9bf6f5a7c27affdd553cf752d51d8f7513ff150a1dca2d5d
7
+ data.tar.gz: ad5e405c811f861ae524a56c9d7e1d9bb397f4421898d5a103dddc646747b1c6dd5f02d20aafc2e0b40397308e4a897fb13611f3d9615c9d25766e309492ec85
data/CHANGELOG CHANGED
@@ -1,3 +1,15 @@
1
+ === 1.3.1 (2023-09-25)
2
+
3
+ * Bump required_ruby_version to 2.2, since that is lowest version supported by minitest 5.15.0 (jeremyevans)
4
+
5
+ * Update count and assertions for all configured statistics reporters, not just the first (akimd) (#10)
6
+
7
+ === 1.3.0 (2022-07-05)
8
+
9
+ * Bump minimum minitest version to 5.15.0 (jeremyevans)
10
+
11
+ * Detect reporter to use by looking for specific methods, instead of specifically for a Minitest::StatisticsReporter (jeremyevans) (#8)
12
+
1
13
  === 1.2.0 (2021-08-16)
2
14
 
3
15
  * Work correctly with Minitest 5.14+ (jeremyevans)
@@ -25,7 +25,9 @@ module Minitest
25
25
  end
26
26
 
27
27
  def self.parallel_fork_stat_reporter(reporter)
28
- reporter.reporters.detect{|rep| rep.is_a?(StatisticsReporter)}
28
+ reporter.reporters.detect do |rep|
29
+ %w'count assertions results count= assertions='.all?{|meth| rep.respond_to?(meth)}
30
+ end
29
31
  end
30
32
 
31
33
  # Override __run to use a child forks to run the speeds, which
@@ -42,7 +44,7 @@ module Minitest
42
44
  n.times do |i|
43
45
  read, write = IO.pipe.each{|io| io.binmode}
44
46
  reads << read
45
- fork do
47
+ Process.fork do
46
48
  read.close
47
49
  if @after_parallel_fork
48
50
  @after_parallel_fork.call(i)
@@ -52,38 +54,13 @@ module Minitest
52
54
  suites.each_with_index{|s, j| p_suites << s if j % n == i}
53
55
  p_suites.each do |s|
54
56
  if s.is_a?(Minitest::Parallel::Test::ClassMethods)
55
- s.extend(Unparallelize)
57
+ s.extend(Unparallelize)
56
58
  end
57
59
 
58
60
  s.run(reporter, options)
59
61
  end
60
62
 
61
63
  data = %w'count assertions results'.map{|meth| stat_reporter.send(meth)}
62
- if data[-1].any?{|result| !result.is_a?(Minitest::Result)}
63
- data[-1] = data[-1].map do |result|
64
- Minitest::Result.from(result)
65
- end
66
- end
67
-
68
- data[-1].each do |result|
69
- result.failures.each do |failure|
70
- if failure.is_a?(Minitest::UnexpectedError)
71
- e = failure.respond_to?(:error) ? failure.error : failure.exception
72
- begin
73
- Marshal.dump(e)
74
- rescue TypeError
75
- e2 = RuntimeError.new("Wrapped undumpable exception for: #{e.class}: #{e.message}")
76
- e2.set_backtrace(e.backtrace)
77
- if failure.respond_to?(:error=)
78
- failure.error = e2
79
- else
80
- failure.exception = e2
81
- end
82
- end
83
- end
84
- end
85
- end
86
-
87
64
  write.write(Marshal.dump(data))
88
65
  write.close
89
66
  end
@@ -99,9 +76,12 @@ module Minitest
99
76
  end
100
77
  raise
101
78
  end
102
- stat_reporter.count += count
103
- stat_reporter.assertions += assertions
104
- stat_reporter.results.concat(results)
79
+ reporter.reporters.each do |rep|
80
+ next unless %w'count assertions results count= assertions='.all?{|meth| rep.respond_to?(meth)}
81
+ rep.count += count
82
+ rep.assertions += assertions
83
+ rep.results.concat(results)
84
+ end
105
85
  end
106
86
 
107
87
  nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-parallel_fork
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-16 00:00:00.000000000 Z
11
+ date: 2023-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.11.0
19
+ version: 5.15.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 5.15.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest-hooks
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
20
34
  type: :development
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - ">="
25
39
  - !ruby/object:Gem::Version
26
- version: 5.11.0
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: minitest-global_expectations
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -56,15 +70,16 @@ files:
56
70
  - CHANGELOG
57
71
  - MIT-LICENSE
58
72
  - README.rdoc
59
- - Rakefile
60
73
  - lib/minitest/parallel_fork.rb
61
- - spec/minitest_parallel_fork_example.rb
62
- - spec/minitest_parallel_fork_spec.rb
63
74
  homepage: http://github.com/jeremyevans/minitest-parallel_fork
64
75
  licenses:
65
76
  - MIT
66
- metadata: {}
67
- post_install_message:
77
+ metadata:
78
+ bug_tracker_uri: https://github.com/jeremyevans/minitest-parallel_fork/issues
79
+ changelog_uri: https://github.com/jeremyevans/minitest-parallel_fork/blob/master/CHANGELOG
80
+ mailing_list_uri: https://github.com/jeremyevans/minitest-parallel_fork/discussions
81
+ source_code_uri: https://github.com/jeremyevans/minitest-parallel_fork
82
+ post_install_message:
68
83
  rdoc_options:
69
84
  - "--quiet"
70
85
  - "--line-numbers"
@@ -79,15 +94,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
79
94
  requirements:
80
95
  - - ">="
81
96
  - !ruby/object:Gem::Version
82
- version: '0'
97
+ version: '2.2'
83
98
  required_rubygems_version: !ruby/object:Gem::Requirement
84
99
  requirements:
85
100
  - - ">="
86
101
  - !ruby/object:Gem::Version
87
102
  version: '0'
88
103
  requirements: []
89
- rubygems_version: 3.2.22
90
- signing_key:
104
+ rubygems_version: 3.4.10
105
+ signing_key:
91
106
  specification_version: 4
92
107
  summary: Fork-based parallelization for minitest
93
108
  test_files: []
data/Rakefile DELETED
@@ -1,46 +0,0 @@
1
- require "rake"
2
- require "rake/clean"
3
-
4
- CLEAN.include ["minitest-parallel_fork-*.gem", "rdoc", "coverage"]
5
-
6
- desc "Build minitest-parallel_fork gem"
7
- task :package=>[:clean] do |p|
8
- sh %{#{FileUtils::RUBY} -S gem build minitest-parallel_fork.gemspec}
9
- end
10
-
11
- ### Specs
12
-
13
- desc "Run specs"
14
- task :spec do
15
- ENV['RUBY'] = FileUtils::RUBY
16
- sh %{#{FileUtils::RUBY} spec/minitest_parallel_fork_spec.rb}
17
- end
18
-
19
- task :default=>:spec
20
-
21
- ### RDoc
22
-
23
- RDOC_DEFAULT_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', 'minitest-parallel_fork: fork-based parallelization for minitest']
24
-
25
- begin
26
- gem 'hanna-nouveau'
27
- RDOC_DEFAULT_OPTS.concat(['-f', 'hanna'])
28
- rescue Gem::LoadError
29
- end
30
-
31
- rdoc_task_class = begin
32
- require "rdoc/task"
33
- RDoc::Task
34
- rescue LoadError
35
- require "rake/rdoctask"
36
- Rake::RDocTask
37
- end
38
-
39
- RDOC_OPTS = RDOC_DEFAULT_OPTS + ['--main', 'README.rdoc']
40
-
41
- rdoc_task_class.new do |rdoc|
42
- rdoc.rdoc_dir = "rdoc"
43
- rdoc.options += RDOC_OPTS
44
- rdoc.rdoc_files.add %w"README.rdoc CHANGELOG MIT-LICENSE lib/**/*.rb"
45
- end
46
-
@@ -1,59 +0,0 @@
1
- gem 'minitest'
2
- require 'minitest/global_expectations/autorun'
3
- require 'minitest/parallel_fork'
4
-
5
- a = nil
6
- Minitest.before_parallel_fork do
7
- a = 'a'
8
- print ":parent"
9
- end
10
-
11
- Minitest.after_parallel_fork do |i|
12
- print ":child#{i}#{a}"
13
- end
14
-
15
- if ENV['MPF_TEST_CHILD_FAILURE']
16
- Minitest.on_parallel_fork_marshal_failure do |i|
17
- print ":child-failure#{i}#{a}"
18
- end
19
- end
20
-
21
- class MyExceptionClass < StandardError
22
- attr_reader :something
23
- end
24
-
25
- 4.times do |i|
26
- describe 'minitest/parallel_fork' do
27
- parallelize_me! if ENV['MPF_PARALLELIZE_ME']
28
-
29
- if ENV['MPF_TEST_ORDER_PARALLEL']
30
- def self.test_order
31
- :parallel
32
- end
33
- end
34
-
35
- it "should work" do
36
- sleep(1)
37
- 1.must_equal 1
38
- end
39
-
40
- it "should fail" do
41
- 1.must_equal 2
42
- end
43
-
44
- it "should raise" do
45
- exit(1) if ENV['MPF_TEST_CHILD_FAILURE']
46
- raise
47
- end
48
-
49
- it "should raise exception containing undumpable data" do
50
- e = MyExceptionClass.new("error")
51
- e.something = Class.new
52
- raise e
53
- end
54
-
55
- it "should skip" do
56
- skip
57
- end
58
- end
59
- end
@@ -1,40 +0,0 @@
1
- ENV['MT_NO_PLUGINS'] = '1'
2
- gem 'minitest'
3
- require 'minitest/global_expectations/autorun'
4
-
5
- describe 'minitest/parallel_fork' do
6
- [[nil, ''],
7
- ['MPF_PARALLELIZE_ME', ' when parallelize_me! is used'],
8
- ['MPF_TEST_ORDER_PARALLEL', ' when test_order parallel is used']
9
- ].each do |env_key, msg|
10
- it "should execute in parallel#{msg}" do
11
- t = Time.now
12
- ENV['NCPU'] = '4'
13
- ENV[env_key] = '1' if env_key
14
- output = `#{ENV['RUBY']} -I lib spec/minitest_parallel_fork_example.rb`
15
- ENV.delete(env_key) if env_key
16
-
17
- time = (Time.now - t)
18
- time.must_be :<, 4
19
- time.must_be :>, 1
20
- output.must_match /:parent/
21
- output.must_match /20 runs, 8 assertions, 4 failures, 8 errors, 4 skips/
22
- 4.times do |i|
23
- output.must_match /:child#{i}a/
24
- end
25
- end
26
- end
27
-
28
- it "should call on_parallel_fork_marshal_failure on failure" do
29
- t = Time.now
30
- ENV['NCPU'] = '4'
31
- ENV['MPF_TEST_CHILD_FAILURE'] = '1'
32
- output = `#{ENV['RUBY']} -I lib spec/minitest_parallel_fork_example.rb 2>&1`
33
- ENV.delete('MPF_TEST_CHILD_FAILURE')
34
-
35
- time = (Time.now - t)
36
- time.must_be :<, 4
37
- output.must_match /:child-failurea/
38
- output.must_match /marshal data too short/
39
- end
40
- end