parallel_split_test 0.7.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 45de1287c50f21414ec9cfd8cd44f15063757423
4
- data.tar.gz: 77b10746bf20d6b9b0bbc334617d3c1648c7ba5f
2
+ SHA256:
3
+ metadata.gz: a1658b4c2471eed1d445277733fe35bafc02391b0440ea8754d8e7bf24a683a2
4
+ data.tar.gz: 0e98524d5a2143c32763d817d41f614b35042630fe45539ab8c47ac59e201a09
5
5
  SHA512:
6
- metadata.gz: 01bf113de23323bdbb7f64eef5f4aeb885cf40dd915e0d1701dc6bf9995b7773b43f8c1cc06f1ad9b4d086453cec57e45da5dc4b550281917e30ae8bd5d8f7e7
7
- data.tar.gz: e72f3554bae41f8590eb896d9e8ae69da8ae62ff2f9efb4a844274142f8b0a6a73dc068b1585d0cdfc22df8c19924270d56b2f3a9c6778074a7051776aae4e28
6
+ metadata.gz: 7fd7f45e0e4c0b8f129d793b94ecbe156240f14736b046ca31990a5f5ce054e4eaa6aab4c72d6c9f01fbc3aedf70c45729310301c882dc35f50c0ebb4b94b279
7
+ data.tar.gz: af969169b4d89ec417b706802b72680fe7da1bee6eee1ed5c9e64ea6cd4fa0a3ace242ceb0f20fd701593a009b7915e7d4bed3e278f201a4a47ecff25bae1960
data/Readme.md CHANGED
@@ -68,6 +68,38 @@ TIPS
68
68
  - set number of processes to use with `PARALLEL_SPLIT_TEST_PROCESSES` environment variable
69
69
  - [unify JUnit output](http://dresscode.renttherunway.com/blog/631) for rspec
70
70
 
71
+
72
+ before(:all) rspec hooks
73
+ ========================
74
+
75
+ The `before(:all)` hooks in rspec will be executed once for every process that runs a test in an example group. This means if you have more processes than tests in a group, the `before(:all)` block for that group will be fired N times. For example, this spec has 3 tests and a `before(:all)` block:
76
+
77
+ ```ruby
78
+ describe "before all behavior"
79
+ before(:all) do
80
+ puts "Process: #{Process.pid} Before ALL"
81
+ end
82
+
83
+ it "a" do
84
+ end
85
+
86
+ it "b" do
87
+ end
88
+
89
+ it "c" do
90
+ end
91
+ end
92
+ ```
93
+
94
+ When you run this with 3 or more processes you'll see the `before(:all)` call is invoked 3 times, once per each process (since "a", "b", and "c" tests are each run on a different process).
95
+
96
+ ```
97
+ $ PARALLEL_SPLIT_TEST_PROCESSES=3 bundle exec parallel_split_test spec/ | grep "Before ALL"
98
+ Process: 31539 Before ALL
99
+ Process: 31538 Before ALL
100
+ Process: 31540 Before ALL
101
+ ```
102
+
71
103
  TODO
72
104
  ====
73
105
  - Cucumber support
@@ -1,8 +1,7 @@
1
1
  require 'parallel_split_test'
2
2
  require 'parallel_split_test/output_recorder'
3
3
  require 'parallel'
4
- require 'rspec'
5
- require 'parallel_split_test/core_ext/rspec_example'
4
+ require 'rspec/core'
6
5
  require 'parallel_split_test/core_ext/rspec_world'
7
6
 
8
7
  module ParallelSplitTest
@@ -2,14 +2,14 @@ require 'parallel_split_test'
2
2
  require 'rspec/core/example'
3
3
 
4
4
  RSpec::Core::World.class_eval do
5
- alias :example_count_without_parallel_split_test :example_count
6
- def example_count(*args, &block)
7
- count = example_count_without_parallel_split_test(*args, &block)
8
- quotient = count / ParallelSplitTest.processes
9
- if ParallelSplitTest.process_number < count % ParallelSplitTest.processes
10
- quotient + 1
11
- else
12
- quotient
5
+ alias :original_prepare_example_filtereing :prepare_example_filtering
6
+
7
+ def prepare_example_filtering
8
+ @original_filtered_examples = original_prepare_example_filtereing
9
+ @filtered_examples = Hash.new do |hash, group|
10
+ hash[group] = @original_filtered_examples[group].select do |x|
11
+ ParallelSplitTest.run_example?
12
+ end
13
13
  end
14
14
  end
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module ParallelSplitTest
2
- VERSION = '0.7.0'
2
+ VERSION = '0.10.0'
3
3
  end
@@ -14,11 +14,7 @@ module ParallelSplitTest
14
14
  end
15
15
 
16
16
  def best_number_of_processes
17
- [
18
- ENV['PARALLEL_SPLIT_TEST_PROCESSES'],
19
- Parallel.physical_processor_count,
20
- Parallel.processor_count
21
- ].map(&:to_i).find{|number| number > 0 }
17
+ Integer(ENV['PARALLEL_SPLIT_TEST_PROCESSES'] || Parallel.processor_count)
22
18
  end
23
19
  end
24
20
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel_split_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-27 00:00:00.000000000 Z
11
+ date: 2021-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rspec
14
+ name: rspec-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.1.0
19
+ version: 3.9.0
20
20
  type: :runtime
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: 3.1.0
26
+ version: 3.9.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: parallel
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -49,7 +49,6 @@ files:
49
49
  - bin/parallel_split_test
50
50
  - lib/parallel_split_test.rb
51
51
  - lib/parallel_split_test/command_line.rb
52
- - lib/parallel_split_test/core_ext/rspec_example.rb
53
52
  - lib/parallel_split_test/core_ext/rspec_world.rb
54
53
  - lib/parallel_split_test/output_recorder.rb
55
54
  - lib/parallel_split_test/runner.rb
@@ -66,15 +65,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
65
  requirements:
67
66
  - - ">="
68
67
  - !ruby/object:Gem::Version
69
- version: 2.1.0
68
+ version: 2.2.0
70
69
  required_rubygems_version: !ruby/object:Gem::Requirement
71
70
  requirements:
72
71
  - - ">="
73
72
  - !ruby/object:Gem::Version
74
73
  version: '0'
75
74
  requirements: []
76
- rubyforge_project:
77
- rubygems_version: 2.5.1
75
+ rubygems_version: 3.2.16
78
76
  signing_key:
79
77
  specification_version: 4
80
78
  summary: Split a big test file into multiple chunks and run them in parallel
@@ -1,13 +0,0 @@
1
- require 'parallel_split_test'
2
- require 'rspec/core/example'
3
-
4
- RSpec::Core::Example.class_eval do
5
- alias :run_without_parallel_split_test :run
6
- def run(*args, &block)
7
- if ParallelSplitTest.run_example?
8
- run_without_parallel_split_test(*args, &block)
9
- else
10
- true # example 'passed'
11
- end
12
- end
13
- end