rspec-multiprocess_runner 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 203c3b7bd50cc7c856265414ea8bcf734f09c8f8
4
+ data.tar.gz: d92e105f0f5aecff2723fc65ccc46db29bd16f4c
5
+ SHA512:
6
+ metadata.gz: 1b678c0f53864275c7e7244d9b9c09c60524217dc9ae639062a66267574c2ae6d6c38c5f8bfc7ee9bad965e4aa6fbe4934533ba81bf66515a815e9d5a0c9fdf8
7
+ data.tar.gz: bf55bb27e8253464dd181f8f2289b6079d90bc292ea1f54d2bb13da4cd69750b93728f649b625b87a034134f74117834d8d06e164295f9394e78c621e6a118ba
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
- - 2.2.3
4
+ - 2.2.4
5
5
  before_install: gem install bundler -v 1.10.6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 0.2.3
2
+
3
+
1
4
  # 0.2.2
2
5
 
3
6
  * Run specs in order of decreasing file size to increase worker utilization
data/exe/multirspec CHANGED
@@ -12,7 +12,8 @@ coordinator = RSpec::MultiprocessRunner::Coordinator.new(
12
12
  {
13
13
  file_timeout_seconds: options.file_timeout_seconds,
14
14
  example_timeout_seconds: options.example_timeout_seconds,
15
- rspec_options: options.rspec_options
15
+ rspec_options: options.rspec_options,
16
+ log_failing_files: options.log_failing_files
16
17
  }
17
18
  )
18
19
 
@@ -29,4 +30,9 @@ end
29
30
 
30
31
  success = coordinator.run
31
32
 
32
- exit(success ? 0 : 1)
33
+ status = if options.log_failing_files
34
+ 0
35
+ else
36
+ success ? 0 : 1
37
+ end
38
+ exit(status)
@@ -6,13 +6,14 @@ module RSpec::MultiprocessRunner
6
6
  # @private
7
7
  class CommandLineOptions
8
8
  attr_accessor :worker_count, :file_timeout_seconds, :example_timeout_seconds,
9
- :rspec_options, :explicit_files_or_directories, :pattern
9
+ :rspec_options, :explicit_files_or_directories, :pattern, :log_failing_files
10
10
 
11
11
  def initialize
12
12
  self.worker_count = 3
13
13
  self.file_timeout_seconds = nil
14
14
  self.example_timeout_seconds = 15
15
15
  self.pattern = "**/*_spec.rb"
16
+ self.log_failing_files = false
16
17
  self.rspec_options = []
17
18
  end
18
19
 
@@ -87,6 +88,10 @@ module RSpec::MultiprocessRunner
87
88
  self.pattern = pattern
88
89
  end
89
90
 
91
+ parser.on("--log-failing-files", "Write failing spec files to multiprocess.failures") do |bool|
92
+ self.log_failing_files = bool
93
+ end
94
+
90
95
  parser.on_tail("-h", "--help", "Prints this help") do
91
96
  help_requested!
92
97
  end
@@ -8,6 +8,7 @@ module RSpec::MultiprocessRunner
8
8
  @worker_count = worker_count
9
9
  @file_timeout_seconds = options[:file_timeout_seconds]
10
10
  @example_timeout_seconds = options[:example_timeout_seconds]
11
+ @log_failing_files = options[:log_failing_files]
11
12
  @rspec_options = options[:rspec_options]
12
13
  @spec_files = sort_files(files)
13
14
  @workers = []
@@ -174,9 +175,12 @@ module RSpec::MultiprocessRunner
174
175
  by_status_and_time = combine_example_results.each_with_object({}) do |result, idx|
175
176
  (idx[result.status] ||= []) << result
176
177
  end
178
+ count_examples(by_status_and_time)
179
+
177
180
  print_skipped_files_details
178
181
  print_pending_example_details(by_status_and_time["pending"])
179
182
  print_failed_example_details(by_status_and_time["failed"])
183
+ log_failed_files(by_status_and_time["failed"]) if @log_failing_files
180
184
  print_failed_process_details
181
185
  puts
182
186
  print_elapsed_time(elapsed)
@@ -192,6 +196,13 @@ module RSpec::MultiprocessRunner
192
196
  (@workers + @stopped_workers).detect { |w| w.example_results.detect { |r| r.status == "failed" } }
193
197
  end
194
198
 
199
+ def count_examples(example_results)
200
+ @metadata = {}
201
+ @metadata[:example_count] = example_results.map { |status, results| results.size }.inject(0) { |sum, ct| sum + ct }
202
+ @metadata[:failure_count] = example_results["failed"] ? example_results["failed"].size : 0
203
+ @metadata[:pending_count] = example_results["pending"] ? example_results["pending"].size : 0
204
+ end
205
+
195
206
  def print_skipped_files_details
196
207
  return if @spec_files.empty?
197
208
  puts
@@ -222,22 +233,38 @@ module RSpec::MultiprocessRunner
222
233
  end
223
234
  end
224
235
 
236
+ def log_failed_files(failed_example_results)
237
+ return if failed_example_results.nil?
238
+ return if failed_example_results.size > @metadata[:example_count] / 10.0
239
+
240
+ failing_files = Hash.new { |h, k| h[k] = 0 }
241
+ failed_example_results.each do |failure|
242
+ failing_files[failure.file_path] += 1
243
+ end
244
+
245
+ puts
246
+ puts "Writing failures to file: multiprocess.failures"
247
+ File.open("multiprocess.failures", "w+") do |io|
248
+ failing_files.each do |(k, _)|
249
+ io << k
250
+ io << "\n"
251
+ end
252
+ end
253
+ end
254
+
225
255
  # Copied from RSpec
226
256
  def pluralize(count, string)
227
257
  "#{count} #{string}#{'s' unless count.to_f == 1}"
228
258
  end
229
259
 
230
260
  def print_example_counts(by_status_and_time)
231
- example_count = by_status_and_time.map { |status, results| results.size }.inject(0) { |sum, ct| sum + ct }
232
- failure_count = by_status_and_time["failed"] ? by_status_and_time["failed"].size : 0
233
- pending_count = by_status_and_time["pending"] ? by_status_and_time["pending"].size : 0
234
261
  process_failure_count = failed_workers.size
235
262
  skipped_count = @spec_files.size
236
263
 
237
264
  # Copied from RSpec
238
- summary = pluralize(example_count, "example")
239
- summary << ", " << pluralize(failure_count, "failure")
240
- summary << ", #{pending_count} pending" if pending_count > 0
265
+ summary = pluralize(@metadata[:example_count], "example")
266
+ summary << ", " << pluralize(@metadata[:failure_count], "failure")
267
+ summary << ", #{@metadata[:pending_count]} pending" if @metadata[:pending_count] > 0
241
268
  summary << ", " << pluralize(process_failure_count, "failed proc") if process_failure_count > 0
242
269
  summary << ", " << pluralize(skipped_count, "skipped file") if skipped_count > 0
243
270
  puts summary
@@ -52,6 +52,8 @@ module RSpec::MultiprocessRunner
52
52
  # rspec binary from the loaded rspec-core gem.
53
53
  attr_accessor :multirspec_path
54
54
 
55
+ attr_accessor :log_failing_files
56
+
55
57
  # Command line options to pass to the RSpec workers. Defaults to `nil`.
56
58
  attr_accessor :rspec_opts
57
59
 
@@ -107,6 +109,9 @@ module RSpec::MultiprocessRunner
107
109
  if pattern
108
110
  cmd_parts << '--pattern' << pattern
109
111
  end
112
+ if log_failing_files
113
+ cmd_parts << '--log-failing-files'
114
+ end
110
115
  if files_or_directories
111
116
  cmd_parts.concat(files_or_directories)
112
117
  end
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module MultiprocessRunner
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
@@ -206,7 +206,8 @@ module RSpec::MultiprocessRunner
206
206
  example_status: example_status,
207
207
  description: description,
208
208
  line_number: line_number,
209
- details: details
209
+ details: details,
210
+ file_path: @current_file
210
211
  )
211
212
  end
212
213
 
@@ -295,12 +296,13 @@ module RSpec::MultiprocessRunner
295
296
 
296
297
  # @private
297
298
  class ExampleResult
298
- attr_reader :status, :description, :details, :time_finished
299
+ attr_reader :status, :description, :details, :file_path, :time_finished
299
300
 
300
301
  def initialize(example_complete_message)
301
302
  @status = example_complete_message["example_status"]
302
303
  @description = example_complete_message["description"]
303
304
  @details = example_complete_message["details"]
305
+ @file_path = example_complete_message["file_path"]
304
306
  @time_finished = Time.now
305
307
  end
306
308
  end
metadata CHANGED
@@ -1,84 +1,75 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-multiprocess_runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
5
- prerelease:
4
+ version: 0.2.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Rhett Sutphin
9
8
  autorequire:
10
9
  bindir: exe
11
10
  cert_chain: []
12
- date: 2016-01-04 00:00:00.000000000 Z
11
+ date: 2016-01-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec-core
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '2.0'
22
- - - <
20
+ - - "<"
23
21
  - !ruby/object:Gem::Version
24
22
  version: 2.99.0
25
23
  type: :runtime
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
- - - ~>
27
+ - - "~>"
31
28
  - !ruby/object:Gem::Version
32
29
  version: '2.0'
33
- - - <
30
+ - - "<"
34
31
  - !ruby/object:Gem::Version
35
32
  version: 2.99.0
36
33
  - !ruby/object:Gem::Dependency
37
34
  name: bundler
38
35
  requirement: !ruby/object:Gem::Requirement
39
- none: false
40
36
  requirements:
41
- - - ~>
37
+ - - "~>"
42
38
  - !ruby/object:Gem::Version
43
39
  version: '1.10'
44
40
  type: :development
45
41
  prerelease: false
46
42
  version_requirements: !ruby/object:Gem::Requirement
47
- none: false
48
43
  requirements:
49
- - - ~>
44
+ - - "~>"
50
45
  - !ruby/object:Gem::Version
51
46
  version: '1.10'
52
47
  - !ruby/object:Gem::Dependency
53
48
  name: rake
54
49
  requirement: !ruby/object:Gem::Requirement
55
- none: false
56
50
  requirements:
57
- - - ~>
51
+ - - "~>"
58
52
  - !ruby/object:Gem::Version
59
53
  version: '10.0'
60
54
  type: :development
61
55
  prerelease: false
62
56
  version_requirements: !ruby/object:Gem::Requirement
63
- none: false
64
57
  requirements:
65
- - - ~>
58
+ - - "~>"
66
59
  - !ruby/object:Gem::Version
67
60
  version: '10.0'
68
61
  - !ruby/object:Gem::Dependency
69
62
  name: rspec
70
63
  requirement: !ruby/object:Gem::Requirement
71
- none: false
72
64
  requirements:
73
- - - ! '>='
65
+ - - ">="
74
66
  - !ruby/object:Gem::Version
75
67
  version: '0'
76
68
  type: :development
77
69
  prerelease: false
78
70
  version_requirements: !ruby/object:Gem::Requirement
79
- none: false
80
71
  requirements:
81
- - - ! '>='
72
+ - - ">="
82
73
  - !ruby/object:Gem::Version
83
74
  version: '0'
84
75
  description:
@@ -89,9 +80,9 @@ executables:
89
80
  extensions: []
90
81
  extra_rdoc_files: []
91
82
  files:
92
- - .gitignore
93
- - .rspec
94
- - .travis.yml
83
+ - ".gitignore"
84
+ - ".rspec"
85
+ - ".travis.yml"
95
86
  - CHANGELOG.md
96
87
  - Gemfile
97
88
  - LICENSE.txt
@@ -112,26 +103,25 @@ files:
112
103
  homepage: https://github.com/cdd/rspec-multiprocess_runner
113
104
  licenses:
114
105
  - MIT
106
+ metadata: {}
115
107
  post_install_message:
116
108
  rdoc_options: []
117
109
  require_paths:
118
110
  - lib
119
111
  required_ruby_version: !ruby/object:Gem::Requirement
120
- none: false
121
112
  requirements:
122
- - - ! '>='
113
+ - - ">="
123
114
  - !ruby/object:Gem::Version
124
115
  version: '0'
125
116
  required_rubygems_version: !ruby/object:Gem::Requirement
126
- none: false
127
117
  requirements:
128
- - - ! '>='
118
+ - - ">="
129
119
  - !ruby/object:Gem::Version
130
120
  version: '0'
131
121
  requirements: []
132
122
  rubyforge_project:
133
- rubygems_version: 1.8.23.2
123
+ rubygems_version: 2.4.5.1
134
124
  signing_key:
135
- specification_version: 3
125
+ specification_version: 4
136
126
  summary: A runner for RSpec 2 that uses multiple processes to execute specs in parallel
137
127
  test_files: []