rspec-multiprocess_runner 1.4.1 → 1.4.2

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
  SHA256:
3
- metadata.gz: 9e0686de0f6ec92d9bfd7eddfb6a8c6ed3a781337dfa8557a49f3034eeff9fdf
4
- data.tar.gz: 61a4bc72b7bff1eace52541606b2b1d9a38bfe2c0a0ae6e6b110947824ddeda8
3
+ metadata.gz: 2ee952287e85072086a4feab9909db4e61d6cafcc3bc6b574795f368e9b4010c
4
+ data.tar.gz: 65a2d11400a0604631eed4cb6dc7df62307b5bd9914a3d768a3bff3316960a11
5
5
  SHA512:
6
- metadata.gz: 64e0d567808840b2672055500fa190e998fd66a08a8459e7456aaa3b3f417197ba4a763f36493a31513060384fb0b0a67bd3686865d503cac4ca6d707189b3eb
7
- data.tar.gz: 72767efc1dfefeb4db2632dab59a9e098e7492475451f90589b5bbee54fcc93455088113ae37e3f514e005aa35e216a8e66bc22241e295bd1f1370d58c92d47c
6
+ metadata.gz: 52295ede507181b2b4f6a738131b3f279845076010421364e22aec501660a7e9ad442fda17723ec9f39f6247ee6f6d371ba0a32cafd8589404d8ce074ec40b1a
7
+ data.tar.gz: 86e482ce416b01185b3e4eed3bd3edaac850155c9d3353d0108cf5a14429329847ff1d741a3319faebcfd9fca22830569bafb87de7031c59b58fd01e2d97bb40
@@ -1,3 +1,10 @@
1
+ # 1.4.2
2
+
3
+ * Add better logging for errors that occur outside of tests
4
+ * Add docker tests for all current ruby versions and more ruby versions to test in
5
+ * Fix some minor bugs that caused incorrect error codes (still failure codes)
6
+ * Fixed the error code spec file
7
+
1
8
  # 1.4.1
2
9
 
3
10
  * Fix file coordinator helpers failing due to unknown method on command line args
@@ -1,36 +1,36 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-multiprocess_runner (1.4.1.pre)
4
+ rspec-multiprocess_runner (1.4.2)
5
5
  rspec (>= 3.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- byebug (11.0.1)
10
+ byebug (11.1.3)
11
11
  coderay (1.1.2)
12
12
  diff-lcs (1.3)
13
- method_source (0.9.2)
14
- pry (0.12.2)
15
- coderay (~> 1.1.0)
16
- method_source (~> 0.9.0)
17
- pry-byebug (3.7.0)
13
+ method_source (1.0.0)
14
+ pry (0.13.1)
15
+ coderay (~> 1.1)
16
+ method_source (~> 1.0)
17
+ pry-byebug (3.9.0)
18
18
  byebug (~> 11.0)
19
- pry (~> 0.10)
20
- rake (10.5.0)
21
- rspec (3.8.0)
22
- rspec-core (~> 3.8.0)
23
- rspec-expectations (~> 3.8.0)
24
- rspec-mocks (~> 3.8.0)
25
- rspec-core (3.8.2)
26
- rspec-support (~> 3.8.0)
27
- rspec-expectations (3.8.5)
19
+ pry (~> 0.13.0)
20
+ rake (13.0.1)
21
+ rspec (3.9.0)
22
+ rspec-core (~> 3.9.0)
23
+ rspec-expectations (~> 3.9.0)
24
+ rspec-mocks (~> 3.9.0)
25
+ rspec-core (3.9.2)
26
+ rspec-support (~> 3.9.3)
27
+ rspec-expectations (3.9.2)
28
28
  diff-lcs (>= 1.2.0, < 2.0)
29
- rspec-support (~> 3.8.0)
30
- rspec-mocks (3.8.2)
29
+ rspec-support (~> 3.9.0)
30
+ rspec-mocks (3.9.1)
31
31
  diff-lcs (>= 1.2.0, < 2.0)
32
- rspec-support (~> 3.8.0)
33
- rspec-support (3.8.3)
32
+ rspec-support (~> 3.9.0)
33
+ rspec-support (3.9.3)
34
34
  stub_env (1.0.4)
35
35
  rspec (>= 2.0, < 4.0)
36
36
 
@@ -40,9 +40,9 @@ PLATFORMS
40
40
  DEPENDENCIES
41
41
  bundler (>= 1.10)
42
42
  pry-byebug
43
- rake (~> 10.0)
43
+ rake (>= 12.3.3)
44
44
  rspec-multiprocess_runner!
45
45
  stub_env
46
46
 
47
47
  BUNDLED WITH
48
- 2.0.2
48
+ 2.1.4
@@ -41,7 +41,7 @@ module RSpec::MultiprocessRunner
41
41
  def exit_code
42
42
  exit_code = 0
43
43
  exit_code |= 1 if any_example_failed?
44
- exit_code |= 2 if !failed_workers.empty?
44
+ exit_code |= 2 if failed_workers.any? || error_messages.any?
45
45
  exit_code |= 4 if work_left_to_do? || @file_coordinator.missing_files.any?
46
46
  exit_code
47
47
  end
@@ -52,10 +52,10 @@ module RSpec::MultiprocessRunner
52
52
  end_workers_in_parallel(@workers.dup, :kill_now)
53
53
  else
54
54
  @shutting_down = true
55
- print "Shutting down #{pluralize(@workers.size, "worker")} …" if options.print_summary
55
+ print "Shutting down #{pluralize(@workers.size, "worker")} …" if options[:print_summary]
56
56
  # end_workers_in_parallel modifies @workers, so dup before sending in
57
57
  end_workers_in_parallel(@workers.dup, :shutdown_now)
58
- if options.print_summary
58
+ if options[:print_summary]
59
59
  puts " done"
60
60
  print_summary
61
61
  end
@@ -221,6 +221,7 @@ module RSpec::MultiprocessRunner
221
221
  print_missing_files(output)
222
222
  log_failed_files(output, by_status_and_time["failed"].map(&:filename).uniq + @file_coordinator.missing_files.to_a) if options.log_failing_files
223
223
  print_failed_process_details(output)
224
+ print_error_messages(output)
224
225
  output.puts
225
226
  print_elapsed_time(output, elapsed)
226
227
  output.puts failed? ? "FAILURE" : "SUCCESS"
@@ -233,6 +234,10 @@ module RSpec::MultiprocessRunner
233
234
  @file_coordinator.results.select { |r| r.run_status == "example_complete" }.sort_by { |r| r.time_finished }
234
235
  end
235
236
 
237
+ def error_messages
238
+ @file_coordinator.results.select { |r| r.run_status == "error_running" }.sort_by { |r| r.time_finished }
239
+ end
240
+
236
241
  def any_example_failed?
237
242
  @file_coordinator.results.detect { |r| r.status == "failed" }
238
243
  end
@@ -290,6 +295,7 @@ module RSpec::MultiprocessRunner
290
295
  pending_count = by_status_and_time["pending"] ? by_status_and_time["pending"].size : 0
291
296
  missing_count = @file_coordinator.missing_files.size
292
297
  process_failure_count = failed_workers.size
298
+ error_count = error_messages.size
293
299
  skipped_count = @file_coordinator.remaining_files.size
294
300
 
295
301
  # Copied from RSpec
@@ -297,6 +303,7 @@ module RSpec::MultiprocessRunner
297
303
  summary << ", " << pluralize(failure_count, "failure")
298
304
  summary << ", #{pending_count} pending" if pending_count > 0
299
305
  summary << ", " << pluralize(process_failure_count, "failed proc") if process_failure_count > 0
306
+ summary << ", " << pluralize(error_count, "error") if error_count > 0
300
307
  summary << ", " << pluralize(skipped_count, "skipped file") if skipped_count > 0
301
308
  summary << ", " << pluralize(missing_count, "missing file") if missing_count > 0
302
309
  output.puts summary
@@ -311,6 +318,17 @@ module RSpec::MultiprocessRunner
311
318
  end
312
319
  end
313
320
 
321
+ def print_error_messages(output)
322
+ return if error_messages.nil?
323
+ output.puts
324
+ output.puts "Errors:"
325
+ error_messages.each_with_index do |error, i|
326
+ output.puts
327
+ output.puts " #{i.next}) #{error.filename}"
328
+ output.print error.message
329
+ end
330
+ end
331
+
314
332
  def print_missing_files(output)
315
333
  return if @file_coordinator.missing_files.empty?
316
334
  output.puts
@@ -70,7 +70,7 @@ module RSpec::MultiprocessRunner
70
70
  else
71
71
  return nil # Malformed response, assume done, cease function
72
72
  end
73
- rescue Exception => e
73
+ rescue StandardError => e
74
74
  puts("Got exception #{e} in get_file")
75
75
  return nil # If Error, assume done, cease function
76
76
  end
@@ -59,6 +59,13 @@ module RSpec::MultiprocessRunner
59
59
  )
60
60
  end
61
61
 
62
+ def message(struct)
63
+ message = struct.message
64
+ return if message =~ /^No examples found./
65
+
66
+ worker.report_error(message)
67
+ end
68
+
62
69
  private
63
70
 
64
71
  def capture_output
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module MultiprocessRunner
3
- VERSION = "1.4.1"
3
+ VERSION = "1.4.2"
4
4
  end
5
5
  end
@@ -29,6 +29,7 @@ module RSpec::MultiprocessRunner
29
29
 
30
30
  STATUS_EXAMPLE_COMPLETE = "example_complete"
31
31
  STATUS_RUN_COMPLETE = "run_complete"
32
+ ERROR_RUNNING = "error_running"
32
33
 
33
34
  def initialize(environment_number, options)
34
35
  @environment_number = environment_number
@@ -196,6 +197,10 @@ module RSpec::MultiprocessRunner
196
197
  end
197
198
  $stdout.puts "#{environment_number} (#{pid}): #{message_hash["description"]} (#{location})#{suffix}"
198
199
  @current_example_started_at = Time.now
200
+ when ERROR_RUNNING
201
+ example_results << Result.new(message_hash)
202
+ $stdout.puts "Error in file: #{message_hash["filename"]}"
203
+ $stdout.print message_hash["message"]
199
204
  else
200
205
  $stderr.puts "Received unsupported status #{message_hash["status"].inspect} in worker #{pid}"
201
206
  end
@@ -219,7 +224,15 @@ module RSpec::MultiprocessRunner
219
224
  description: description,
220
225
  line_number: line_number,
221
226
  details: details,
222
- filename: @current_file
227
+ filename: @current_file,
228
+ )
229
+ end
230
+
231
+ def report_error(message)
232
+ send_message_to_coordinator(
233
+ status: ERROR_RUNNING,
234
+ message: message,
235
+ filename: @current_file,
223
236
  )
224
237
  end
225
238
 
@@ -281,8 +294,9 @@ module RSpec::MultiprocessRunner
281
294
  RSpec.world.example_groups.clear
282
295
 
283
296
  ReportingFormatter.worker = self
284
- RSpec::Core::Runner.run(@rspec_arguments + [spec_file])
285
- raise "Error outside of tests on #{spec_file}" if RSpec.world.non_example_failure
297
+ error_stream = StringIO.new
298
+ output_stream = StringIO.new
299
+ RSpec::Core::Runner.run(@rspec_arguments + [spec_file], error_stream, output_stream)
286
300
  send_message_to_coordinator(status: STATUS_RUN_COMPLETE, filename: spec_file)
287
301
  ensure
288
302
  @current_file = nil
@@ -323,7 +337,7 @@ module RSpec::MultiprocessRunner
323
337
 
324
338
  # @private
325
339
  class Result
326
- attr_reader :run_status, :status, :description, :details, :filename, :time_finished
340
+ attr_reader :description, :details, :filename, :message, :run_status, :status, :time_finished
327
341
 
328
342
  def initialize(complete_message, time = Time.now)
329
343
  @hash = complete_message
@@ -332,6 +346,7 @@ module RSpec::MultiprocessRunner
332
346
  @description = complete_message["description"]
333
347
  @details = complete_message["details"]
334
348
  @filename = complete_message["filename"]
349
+ @message = complete_message["message"]
335
350
  @time_finished = time
336
351
  end
337
352
 
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_development_dependency "bundler", ">= 1.10"
24
24
  spec.add_development_dependency "pry-byebug"
25
- spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "byebug", "<11" if RUBY_VERSION.to_f < 2.4
26
+ spec.add_development_dependency "rake", ">= 12.3.3"
26
27
  spec.add_development_dependency "stub_env"
27
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-multiprocess_runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rhett Sutphin
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2019-12-14 00:00:00.000000000 Z
14
+ date: 2020-05-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec
@@ -59,16 +59,16 @@ dependencies:
59
59
  name: rake
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
- - - "~>"
62
+ - - ">="
63
63
  - !ruby/object:Gem::Version
64
- version: '10.0'
64
+ version: 12.3.3
65
65
  type: :development
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - "~>"
69
+ - - ">="
70
70
  - !ruby/object:Gem::Version
71
- version: '10.0'
71
+ version: 12.3.3
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: stub_env
74
74
  requirement: !ruby/object:Gem::Requirement
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  requirements: []
134
- rubygems_version: 3.0.6
134
+ rubygems_version: 3.0.3
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: A runner for RSpec 3 that uses multiple processes to execute specs in parallel