parallel_rspec 2.2.0 → 2.4.0

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: 6d2e2199456f48d4b9726672b0c5e223b536350826d46b1bc14ff28e5d83ef45
4
- data.tar.gz: ae4b625e1041147f8e6c4087196fe34bb97977fb0034549e9436b4056363f184
3
+ metadata.gz: 6a72d4e48cb7e1973a00e66c2fcae145cbe17c238ed051666856365716f1cd67
4
+ data.tar.gz: e4b27f1a20a0e3d329fb146592af425aa0f5887cd18fe71784c8f432e62993ad
5
5
  SHA512:
6
- metadata.gz: a27c85ac8cc1ef08b04ac61054848eeed0dfbe08465fd4814d0a6909dd18891df71d7bbe9011f2fe0281a028bdd62550988d2716f707d3ea1a11d12139d67772
7
- data.tar.gz: 584531e1f3027132097cebb1a36e600ae7e470ce62b91bc23522352dc39f14a7c1c80b34b92a1c5298bbdb079fb51c1204962945577c6cdf549e14dd944f8a22
6
+ metadata.gz: 12770663bed8e75c5cd24743a177ac3ba01b3d07165dce4ef2e921219dd4a2dc62eaa013c12ffd43d0f7f2565484b0b33330249a1b46ea4e4e6d046518f5b469
7
+ data.tar.gz: e15b6a238cbf5249472eaca4fbd52073ea001f7f01ca8a41be1732cea1aa529d3c3159d5dcef22353d25815d0ea814e100785ad977fd1f2862f904dda47e2273
data/CHANGES.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.4.0
4
+
5
+ * Wrap Exception objects so they can always be dumped and loaded, even if they contain non-marshallable objects such as Procs or anonymous classes.
6
+
7
+ ## 2.3.0
8
+
9
+ * Increase default workers from 2 to 4.
10
+ * Fix behavioral inconsistency with rspec-core in nested describe blocks on helper methods with clashing let methods.
11
+
3
12
  ## 2.2.0
4
13
 
5
14
  * Fix incompatibility with `rspec --profile`.
data/README.md CHANGED
@@ -28,9 +28,9 @@ This version of ParallelRSpec has been tested with RSpec 3.12.
28
28
 
29
29
  ## Usage
30
30
 
31
- By default, ParallelRSpec will use two workers. If you would like to use more, set an environment variable:
31
+ By default, ParallelRSpec will use four workers. If you would like to use more, set an environment variable:
32
32
 
33
- $ export WORKERS=4
33
+ $ export WORKERS=8
34
34
 
35
35
  ParallelRSpec runs each worker with its own copy of the test database to avoid locking and deadlocking problems. To create these and populate them with your schema, run:
36
36
 
@@ -59,7 +59,7 @@ By default, there's a task called `parallel_rspec` which will run all specs. To
59
59
  require 'parallel_rspec'
60
60
 
61
61
  ParallelRSpec::RakeTask.new(:prspec) do |t|
62
- ENV['WORKERS'] = '4'
62
+ ENV['WORKERS'] = '8'
63
63
  t.pattern = "spec/**/*_spec.rb"
64
64
  t.rspec_opts = "--tag parallel"
65
65
  # etc...
@@ -1,4 +1,33 @@
1
1
  module ParallelRSpec
2
+ # Some Exception objects contain non-marshallable ivars such as Proc objects. This wrapper
3
+ # represents the bits needed by RSpec's ExceptionPresenter, and can be dumped and loaded.
4
+ class ExceptionMarshallingWrapper < Exception
5
+ attr_reader :class_name, :message, :backtrace, :cause
6
+
7
+ def initialize(class_name, message, backtrace, cause)
8
+ @class_name = class_name
9
+ @message = message
10
+ @backtrace = backtrace
11
+ @cause = cause
12
+ end
13
+
14
+ def class
15
+ eval "class #{@class_name}; end; #{@class_name}"
16
+ end
17
+
18
+ def inspect
19
+ "#<#{@class_name}: #{@message}>"
20
+ end
21
+
22
+ def ==(other)
23
+ other.is_a?(ExceptionMarshallingWrapper) &&
24
+ class_name == other.class_name &&
25
+ message == other.message &&
26
+ backtrace == other.backtrace &&
27
+ cause == other.cause
28
+ end
29
+ end
30
+
2
31
  class Client
3
32
  attr_reader :channel_to_server
4
33
 
@@ -39,8 +68,9 @@ module ParallelRSpec
39
68
  end
40
69
 
41
70
  def updates_from(example)
71
+ example.execution_result.exception = dumpable_exception(example.execution_result.exception)
42
72
  {
43
- exception: example.exception,
73
+ exception: dumpable_exception(example.exception),
44
74
  metadata: example.metadata.slice(
45
75
  :execution_result,
46
76
  :pending,
@@ -49,6 +79,11 @@ module ParallelRSpec
49
79
  }
50
80
  end
51
81
 
82
+ def dumpable_exception(exception)
83
+ return exception if exception.nil? || exception.is_a?(ExceptionMarshallingWrapper)
84
+ ExceptionMarshallingWrapper.new(exception.class.name, exception.to_s, exception.backtrace, dumpable_exception(exception.cause))
85
+ end
86
+
52
87
  def next_example_to_run
53
88
  channel_to_server.write([:next_example_to_run])
54
89
  channel_to_server.read
@@ -77,6 +77,7 @@ module ParallelRSpec
77
77
  while next_example = client.next_example_to_run
78
78
  example_group, example_index = *next_example
79
79
  example = RSpec.world.filtered_examples[example_group][example_index]
80
+ example_group.parent_groups.reverse_each { |parent_group| parent_group.new("dummy instance to trigger helper loading order") }
80
81
  example_group_instance = example_group.new(example.inspect_output)
81
82
  success = example.run(example_group_instance, client) && success
82
83
  end
@@ -59,7 +59,8 @@ db_namespace = namespace :db do
59
59
  desc "Recreate the test databases from the current schema"
60
60
  task :load do
61
61
  db_namespace["parallel:purge"].invoke
62
- case ActiveRecord::Base.schema_format
62
+ schema_format = ActiveRecord.respond_to?(:schema_format) ? ActiveRecord.schema_format : ActiveRecord::Base.schema_format
63
+ case schema_format
63
64
  when :ruby
64
65
  db_namespace["parallel:load_schema"].invoke
65
66
  when :sql
@@ -1,3 +1,3 @@
1
1
  module ParallelRSpec
2
- VERSION = "2.2.0"
2
+ VERSION = "2.4.0"
3
3
  end
@@ -2,7 +2,7 @@ module ParallelRSpec
2
2
  class Workers
3
3
  def self.number_of_workers
4
4
  workers = ENV['WORKERS'].to_i
5
- workers = 2 if workers.zero?
5
+ workers = 4 if workers.zero?
6
6
  workers
7
7
  end
8
8
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel_rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Bryant, Powershop New Zealand Ltd
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-02 00:00:00.000000000 Z
11
+ date: 2023-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake