parallel_rspec 2.3.0 → 2.4.1

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: c7a38c7f6a685aef852543e1c676aae48e0066fd98f5b6b51c3ca44ca1b8b3b0
4
- data.tar.gz: 98b98c46b8ef5f8b60066a838b9e58b2df26cd2501086c86d2d7966adb2972cc
3
+ metadata.gz: 9ca6b67912a40f6a2dac54522280f6681c6e5fd1d636f47fcd6fd920aaaad2d3
4
+ data.tar.gz: a43c0c2a4d1ff1a02449b9300e9a2cd64a883bfd3b7057dab377c254dc020e19
5
5
  SHA512:
6
- metadata.gz: 79ab6a5abf73b8c8a788dd45626aa22d25284af00c4146ef9fa0a174adb7d1c648f5fde0399ecbca5f6103df17bd70c389ee22a9b05e88da9a98a463ee39ca21
7
- data.tar.gz: 31d2d263fa915de652ce0e990b23387d3946ee1d72d265ba3ec8242a6b483cc2b0d095e02b803614a94ce5bd00a363c74714d147ddb66da2c2bef60e892d52a0
6
+ metadata.gz: d769cace0a8065fe7b290ba947245f87b1d1fac8aa14ce91f2f6f9e7cf0b90a553c2ce1af490ef1faa7e22cf1f1ff717930325268109ba49646c8273434e4a21
7
+ data.tar.gz: 8de0ae25969c87584d1e535dd0b447642ee4665593f457794a543355639146f143b836a0dee1e3a98c181ed64364f5dfad355a19a6e4b264665efeabf4e58972
data/CHANGES.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.4.1
4
+
5
+ * Exit workers promptly if asked to quit.
6
+
7
+ ## 2.4.0
8
+
9
+ * Wrap Exception objects so they can always be dumped and loaded, even if they contain non-marshallable objects such as Procs or anonymous classes.
10
+
3
11
  ## 2.3.0
4
12
 
5
13
  * Increase default workers from 2 to 4.
@@ -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,7 +79,13 @@ 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
88
+ return nil if RSpec.world.wants_to_quit
53
89
  channel_to_server.write([:next_example_to_run])
54
90
  channel_to_server.read
55
91
  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.3.0"
2
+ VERSION = "2.4.1"
3
3
  end
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.3.0
4
+ version: 2.4.1
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-03 00:00:00.000000000 Z
11
+ date: 2023-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake