minitest-parallel_fork 1.0.2 → 1.1.0

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
- SHA1:
3
- metadata.gz: 42f6c6919472888f0ad2799def6d83c39bf69ab6
4
- data.tar.gz: e4fe5385b3e8682001470c2c6891bc8eadb49696
2
+ SHA256:
3
+ metadata.gz: 07a0f8e198d9bfcd52a03b4fe0870e49b90ce1dc28d9ada77a158baf406f6eb6
4
+ data.tar.gz: 51f5ee3699e9251138235ea2f4c65a676a2a849e4249ec5528e4614a30837146
5
5
  SHA512:
6
- metadata.gz: 007440c55981f82d53333b49efc3ca47609eed8ad9e7601fb215b125cabe4b8d809181a97b4f467e3f87a97373907dc169401de53f8b547711c9408f67842536
7
- data.tar.gz: 80d30b6fde62eaec6ca63ab203890a19a564243677b7bc9fa5ca01ac56a741c95f79b3dfb484d6b8abb52c2a64b35e7b1a2bb6e546a2dba94bf3ff0a434e8f2b
6
+ metadata.gz: 03fba31357a97e37091d85f6e7fad43c26999b9cc85d95302f0e8ea3432604ab12dc599b6db6228dd08cc6d5a2e30867648bbeb1f1bb2a470aee0b57c7bb7779
7
+ data.tar.gz: 5e5617bbfe70c8100afdecbc5908292a6c259caba96871189407d1c5d53108645a59375c4f603ecec62fcd5048ac4bec477c8786d94b09ccf593cdaf6cfacefc
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ === 1.1.0 (2018-04-19)
2
+
3
+ * Remove DumpableUnexpectedError, require minitest 5.11.0+ (jeremyevans)
4
+
5
+ * Allow overriding the stat reporter used via Minitest.parallel_fork_stat_reporter method (jeremyevans) (#3)
6
+
1
7
  === 1.0.2 (2017-02-27)
2
8
 
3
9
  * Show correct number of errors in output (jeremyevans)
data/README.rdoc CHANGED
@@ -1,7 +1,7 @@
1
1
  = minitest-parallel_fork
2
2
 
3
3
  minitest-parallel_fork adds fork-based parallelization to Minitest. Each test/spec
4
- suite is run one of the forks, allowing this to work correctly when using
4
+ suite is run in one of the forks, allowing this to work correctly when using
5
5
  before_all/after_all/around_all hooks provided by minitest-hooks. Using separate
6
6
  processes via fork can significantly improve spec performance when using MRI,
7
7
  and can work in cases where Minitest's default thread-based parallelism do not work,
@@ -55,7 +55,7 @@ of the child process, starting at 0:
55
55
 
56
56
  The above examples show a fairly easy way to use minitest-parallel_fork with an external
57
57
  database when using Sequel. Before forking, all existing database connections are
58
- disconnecting, and after forking, the database name is changed in each child to reference
58
+ disconnected, and after forking, the database name is changed in each child to reference
59
59
  a child-specific database, so that the child processes do not share a database and are
60
60
  thus independent.
61
61
 
data/Rakefile CHANGED
@@ -13,7 +13,6 @@ end
13
13
  desc "Run specs"
14
14
  task :spec do
15
15
  ENV['RUBY'] = FileUtils::RUBY
16
- ENV['RUBYOPT'] = "#{ENV['RUBYOPT']} -rubygems"
17
16
  sh %{#{FileUtils::RUBY} spec/minitest_parallel_fork_spec.rb}
18
17
  end
19
18
 
@@ -12,39 +12,19 @@ module Minitest
12
12
  @after_parallel_fork = block
13
13
  end
14
14
 
15
- # Subclass of Assertion for unexpected errors. UnexpectedError
16
- # can not be used as it can include undumpable objects. This
17
- # class converts all data it needs to plain strings, so that
18
- # it will be dumpable.
19
- class DumpableUnexpectedError < Assertion # :nodoc:
20
- attr_accessor :backtrace
21
-
22
- def initialize(unexpected)
23
- exception_class_name = unexpected.exception.class.name.to_s
24
- exception_message = unexpected.exception.message.to_s
25
- super("#{exception_class_name}: #{exception_message}")
26
- self.backtrace = unexpected.exception.backtrace.map(&:to_s)
27
- end
28
-
29
- def message
30
- bt = Minitest.filter_backtrace(backtrace).join "\n "
31
- "#{super}\n #{bt}"
32
- end
33
-
34
- def result_label
35
- "Error"
36
- end
37
- end
38
-
39
15
  module Unparallelize
40
16
  define_method(:run_one_method, &Minitest::Test.method(:run_one_method))
41
17
  end
18
+
19
+ def self.parallel_fork_stat_reporter(reporter)
20
+ reporter.reporters.detect{|rep| rep.is_a?(StatisticsReporter)}
21
+ end
42
22
 
43
23
  # Override __run to use a child forks to run the speeds, which
44
24
  # allows for parallel spec execution on MRI.
45
25
  def self.__run(reporter, options)
46
26
  suites = Runnable.runnables.shuffle
47
- stat_reporter = reporter.reporters.detect{|rep| rep.is_a?(StatisticsReporter)}
27
+ stat_reporter = parallel_fork_stat_reporter(reporter)
48
28
 
49
29
  n = (ENV['NCPU'] || 4).to_i
50
30
  reads = []
@@ -71,10 +51,6 @@ module Minitest
71
51
  end
72
52
 
73
53
  data = %w'count assertions results'.map{|meth| stat_reporter.send(meth)}
74
- data[-1] = data[-1].map do |res|
75
- [res.name, res.failures.map{|f| f.is_a?(UnexpectedError) ? DumpableUnexpectedError.new(f) : f}]
76
- end
77
-
78
54
  write.write(Marshal.dump(data))
79
55
  write.close
80
56
  end
@@ -89,11 +65,6 @@ module Minitest
89
65
  count, assertions, results = Marshal.load(data)
90
66
  stat_reporter.count += count
91
67
  stat_reporter.assertions += assertions
92
- results.map! do |name, failures|
93
- runnable = Test.new(name)
94
- runnable.failures.concat(failures.map{|f| f.is_a?(DumpableUnexpectedError) ? UnexpectedError.new(f) : f})
95
- runnable
96
- end
97
68
  stat_reporter.results.concat(results)
98
69
  end
99
70
  end.join
metadata CHANGED
@@ -1,32 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-parallel_fork
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-27 00:00:00.000000000 Z
11
+ date: 2018-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5'
19
+ version: 5.11.0
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '5'
26
+ version: 5.11.0
27
27
  description: |
28
28
  minitest-parallel_fork adds fork-based parallelization to Minitest. Each test/spec
29
- suite is run one of the forks, allowing this to work correctly when using
29
+ suite is run in one of the forks, allowing this to work correctly when using
30
30
  before_all/after_all/around_all hooks provided by minitest-hooks. Using separate
31
31
  processes via fork can significantly improve spec performance when using MRI,
32
32
  and can work in cases where Minitest's default thread-based parallelism do not work,
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  version: '0'
74
74
  requirements: []
75
75
  rubyforge_project:
76
- rubygems_version: 2.6.8
76
+ rubygems_version: 2.7.6
77
77
  signing_key:
78
78
  specification_version: 4
79
79
  summary: Fork-based parallelization for minitest