minitest-parallel_fork 1.0.0 → 1.0.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
  SHA1:
3
- metadata.gz: 09d52a418fc9f248ded3902c4b7a5fd4b775cdfa
4
- data.tar.gz: 36a3dcb18d5b7652af47c934c8a8a082a8ea78bc
3
+ metadata.gz: eba31fcb9f0832fd81e818423d5f628ea679bd2f
4
+ data.tar.gz: bf91180a0b69834f62519d1ada73fd1ce790fa98
5
5
  SHA512:
6
- metadata.gz: ccc49c0c045f2c9f8d3c6003373306fa75c787bee8b95eec0c401e9e9c5353f91635f52fce24714b7d2ffb7ab7f7e849abcb7dedaae0c3210009dbcb7e00b8f8
7
- data.tar.gz: dd22675a8b0cbe257640b8c2ff518f30990b827ba8c02b1d33b89c49fa84d28fca37e5a9ba7e26fcdd7cdef87fb26d525ae1196dd373069cb0e944297ca0a9e9
6
+ metadata.gz: 364efbc3cff8e3e9b609b1fb8685c19866b8ce074f542edc1ef6c6cd78dd8be91aa14aba5d7bd4ba89ac612519f87e99930df776e0bdbf529a523c75fb3545b1
7
+ data.tar.gz: 76cd985717baf5d01b7ef92a3c3e0800dc6c186be4e61f757d4f15d4bf1e82a11acd72740cfc5fde302d4749ada3aa67eee9cd5da9698ff9601952cb7ff40451
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.0.1 (2017-01-05)
2
+
3
+ * Work with test suites that use parallelize_me! (jeremyevans) (#1)
4
+
1
5
  === 1.0.0 (2015-05-11)
2
6
 
3
7
  * Initial Public Release
@@ -36,6 +36,10 @@ module Minitest
36
36
  end
37
37
  end
38
38
 
39
+ module Unparallelize
40
+ define_method(:run_one_method, &Minitest::Test.method(:run_one_method))
41
+ end
42
+
39
43
  # Override __run to use a child forks to run the speeds, which
40
44
  # allows for parallel spec execution on MRI.
41
45
  def self.__run(reporter, options)
@@ -58,8 +62,13 @@ module Minitest
58
62
 
59
63
  p_suites = []
60
64
  suites.each_with_index{|s, j| p_suites << s if j % n == i}
61
- p_suites.partition{|s| s.test_order != :parallel}.
62
- map{|ss| ss.map{|s| s.run(reporter, options) }}
65
+ p_suites.each do |s|
66
+ if s.is_a?(Minitest::Parallel::Test::ClassMethods)
67
+ s.extend(Unparallelize)
68
+ end
69
+
70
+ s.run(reporter, options)
71
+ end
63
72
 
64
73
  data = %w'count assertions results'.map{|meth| stat_reporter.send(meth)}
65
74
  data[-1] = data[-1].map do |res|
@@ -1,3 +1,4 @@
1
+ gem 'minitest'
1
2
  require 'minitest/autorun'
2
3
  require 'minitest/parallel_fork'
3
4
 
@@ -13,6 +14,14 @@ end
13
14
 
14
15
  4.times do |i|
15
16
  describe 'minitest/parallel_fork' do
17
+ parallelize_me! if ENV['MPF_PARALLELIZE_ME']
18
+
19
+ if ENV['MPF_TEST_ORDER_PARALLEL']
20
+ def self.test_order
21
+ :parallel
22
+ end
23
+ end
24
+
16
25
  it "should work" do
17
26
  sleep(1).must_equal 1
18
27
  end
@@ -1,14 +1,25 @@
1
+ gem 'minitest'
1
2
  require 'minitest/autorun'
2
3
 
3
4
  describe 'minitest/parallel_fork' do
4
- it "should work" do
5
- t = Time.now
6
- ENV['NCPU'] = '4'
7
- output = `#{ENV['RUBY']} -I lib spec/minitest_parallel_fork_example.rb`
8
- (Time.now - t).must_be :<, 4
9
- output.must_match /:parent/
10
- 4.times do |i|
11
- output.must_match /:child#{i}a/
5
+ [[nil, ''],
6
+ ['MPF_PARALLELIZE_ME', ' when parallelize_me! is used'],
7
+ ['MPF_TEST_ORDER_PARALLEL', ' when test_order parallel is used']
8
+ ].each do |env_key, msg|
9
+ it "should execute in parallel#{msg}" do
10
+ t = Time.now
11
+ ENV['NCPU'] = '4'
12
+ ENV[env_key] = '1' if env_key
13
+ output = `#{ENV['RUBY']} -I lib spec/minitest_parallel_fork_example.rb`
14
+ ENV.delete(env_key) if env_key
15
+
16
+ time = (Time.now - t)
17
+ time.must_be :<, 4
18
+ time.must_be :>, 1
19
+ output.must_match /:parent/
20
+ 4.times do |i|
21
+ output.must_match /:child#{i}a/
22
+ end
12
23
  end
13
24
  end
14
25
  end
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.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-11 00:00:00.000000000 Z
11
+ date: 2017-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -73,8 +73,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  version: '0'
74
74
  requirements: []
75
75
  rubyforge_project:
76
- rubygems_version: 2.4.5
76
+ rubygems_version: 2.6.8
77
77
  signing_key:
78
78
  specification_version: 4
79
- summary: Fork-based parallelization for minitest'
79
+ summary: Fork-based parallelization for minitest
80
80
  test_files: []