parallel_tests 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +7 -2
- data/lib/parallel_tests/cli.rb +1 -0
- data/lib/parallel_tests/grouper.rb +7 -7
- data/lib/parallel_tests/test/runner.rb +3 -2
- data/lib/parallel_tests/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e22b7151afe39f71cc882c6feecd4a2649cbec5
|
4
|
+
data.tar.gz: b489f53928ed01b921cacaa4657335668e82f806
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cd0ef9b424966a910ff6f1937a7e098d8aa2a1779f0ab49681029cea179a7cfc753145c2c13534a564f001a3f2577f84600036e60a61bc6bc6f57ccd79f11c1
|
7
|
+
data.tar.gz: 430a8992f2b03cde626b5d47c16d593c58ab497af0b1e92c1f041e42ec2f32596de7dbb9ba87f7e8434481d8c8103fb8ade10311b8d523372c072c2e291f177f
|
data/Readme.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# parallel_tests
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/parallel_tests.svg)](https://rubygems.org/gems/parallel_tests)
|
4
|
+
[![Build Status](https://travis-ci.org/grosser/parallel_tests.svg)](https://travis-ci.org/grosser/parallel_tests/builds)
|
5
|
+
|
1
6
|
Speedup Test::Unit + RSpec + Cucumber + Spinach by running parallel on multiple CPU cores.<br/>
|
2
7
|
ParallelTests splits tests into even groups (by number of lines or runtime) and runs each group in a single process with its own database.
|
3
8
|
|
@@ -222,6 +227,7 @@ TIPS
|
|
222
227
|
- Spring does not work with parallel_tests, use `DISABLE_SPRING=1 rake parallel:spec` if you have spring hardcoded in your binaries
|
223
228
|
- [RSpec] remove `--loadby` from `.rspec`
|
224
229
|
- [RSpec] Instantly see failures (instead of just a red F) with [rspec-instafail](https://github.com/grosser/rspec-instafail)
|
230
|
+
- [RSpec] use [rspec-retry](https://github.com/NoRedInk/rspec-retry) (not rspec-rerun) to rerun failed tests.
|
225
231
|
- [Cucumber] add a `parallel: foo` profile to your `config/cucumber.yml` and it will be used to run parallel tests
|
226
232
|
- [Capybara setup](https://github.com/grosser/parallel_tests/wiki)
|
227
233
|
- [Sphinx setup](https://github.com/grosser/parallel_tests/wiki)
|
@@ -320,5 +326,4 @@ inspired by [pivotal labs](http://pivotallabs.com/users/miked/blog/articles/849-
|
|
320
326
|
|
321
327
|
[Michael Grosser](http://grosser.it)<br/>
|
322
328
|
michael@grosser.it<br/>
|
323
|
-
License: MIT
|
324
|
-
[![Build Status](https://travis-ci.org/grosser/parallel_tests.png)](https://travis-ci.org/grosser/parallel_tests)
|
329
|
+
License: MIT
|
data/lib/parallel_tests/cli.rb
CHANGED
@@ -163,6 +163,7 @@ module ParallelTests
|
|
163
163
|
opts.on('--ignore-tags [PATTERN]', 'When counting steps ignore scenarios with tags that match this pattern') { |arg| options[:ignore_tag_pattern] = arg }
|
164
164
|
opts.on("--nice", "execute test commands with low priority.") { options[:nice] = true }
|
165
165
|
opts.on("--runtime-log [PATH]", "Location of previously recorded test runtimes") { |path| options[:runtime_log] = path }
|
166
|
+
opts.on("--unknown-runtime [FLOAT]", "Use given number as unknown runtime (otherwise use average time)") { |time| options[:unknown_runtime] = time.to_f }
|
166
167
|
opts.on("--verbose", "Print more output") { options[:verbose] = true }
|
167
168
|
opts.on("-v", "--version", "Show Version") { puts ParallelTests::VERSION; exit }
|
168
169
|
opts.on("-h", "--help", "Show this.") { puts opts; exit }
|
@@ -16,24 +16,24 @@ module ParallelTests
|
|
16
16
|
|
17
17
|
# add all files that should run in a single process to one group
|
18
18
|
(options[:single_process] || []).each do |pattern|
|
19
|
-
matched, items = items.partition { |item,
|
19
|
+
matched, items = items.partition { |item, _size| item =~ pattern }
|
20
20
|
matched.each { |item, size| add_to_group(groups.first, item, size) }
|
21
21
|
end
|
22
22
|
|
23
23
|
groups_to_fill = (options[:isolate] ? groups[1..-1] : groups)
|
24
24
|
group_features_by_size(items_to_group(items), groups_to_fill)
|
25
25
|
|
26
|
-
groups.map!{|g| g[:items].sort }
|
26
|
+
groups.map! { |g| g[:items].sort }
|
27
27
|
end
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
31
|
def largest_first(files)
|
32
|
-
files.sort_by{|
|
32
|
+
files.sort_by{|_item, size| size }.reverse
|
33
33
|
end
|
34
34
|
|
35
35
|
def smallest_group(groups)
|
36
|
-
groups.min_by{|g| g[:size] }
|
36
|
+
groups.min_by { |g| g[:size] }
|
37
37
|
end
|
38
38
|
|
39
39
|
def add_to_group(group, item, size)
|
@@ -46,10 +46,10 @@ module ParallelTests
|
|
46
46
|
listener = ParallelTests::Gherkin::Listener.new
|
47
47
|
listener.ignore_tag_pattern = Regexp.compile(options[:ignore_tag_pattern]) if options[:ignore_tag_pattern]
|
48
48
|
parser = ::Gherkin::Parser::Parser.new(listener, true, 'root')
|
49
|
-
tests.each
|
49
|
+
tests.each do |file|
|
50
50
|
parser.parse(File.read(file), file, 0)
|
51
|
-
|
52
|
-
listener.collect.sort_by{|_,value| -value }
|
51
|
+
end
|
52
|
+
listener.collect.sort_by { |_, value| -value }
|
53
53
|
end
|
54
54
|
|
55
55
|
def group_by_scenarios(tests, options={})
|
@@ -170,10 +170,11 @@ module ParallelTests
|
|
170
170
|
puts "Runtime found for #{tests.count(&:last)} of #{tests.size} tests"
|
171
171
|
end
|
172
172
|
|
173
|
-
# fill gaps with average
|
173
|
+
# fill gaps with unknown-runtime if given, average otherwise
|
174
174
|
known, unknown = tests.partition(&:last)
|
175
175
|
average = (known.any? ? known.map!(&:last).inject(:+) / known.size : 1)
|
176
|
-
|
176
|
+
unknown_runtime = options[:unknown_runtime] || average
|
177
|
+
unknown.each { |set| set[1] = unknown_runtime }
|
177
178
|
end
|
178
179
|
|
179
180
|
def runtimes(tests, options)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel_tests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|