parallel_rspec 2.5.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +15 -5
- data/README.md +3 -2
- data/lib/parallel_rspec/caller_filter_patch.rb +11 -0
- data/lib/parallel_rspec/client.rb +40 -10
- data/lib/parallel_rspec/server.rb +28 -2
- data/lib/parallel_rspec/version.rb +1 -1
- data/lib/parallel_rspec.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fad2da0cd1720dc8803b2bf06d3ad7b0b4c71e0856667dd761e449b8c3b3ed5d
|
|
4
|
+
data.tar.gz: 61daddf9f3a36ad24353c487a029d77f7fefd87cf1207a7e79d7326500eb99be
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e4f6821b9aee63cb2b55a8dcadf20e03a55570b24b2f68ad3e2e7f21f6b2f1cc4404ecddbeb3297c1b308a802876d59801bdd2f6b579e0309c80d8a7d16eeaee
|
|
7
|
+
data.tar.gz: 392c4adcd45f25706f47f18ee0be112a30bc5f199a0bcd821d4e5531c58b7e4a4cfa0983d9c144bd44bfdfb7bba19b1d7d683a8b4c63911a2d8c6303bde8f7ab
|
data/CHANGES.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.0.0
|
|
4
|
+
|
|
5
|
+
* Fix reporting of `aggregate_failures` errors.
|
|
6
|
+
* Add this gem's files to the backtrace filter RSpec uses to exclude its own files from failure messages.
|
|
7
|
+
* Implement `--fail-fast` support.
|
|
8
|
+
|
|
9
|
+
## 2.6.0
|
|
10
|
+
|
|
11
|
+
* Fix `--profile` support. Thanks @peret.
|
|
12
|
+
|
|
3
13
|
## 2.5.0
|
|
4
14
|
|
|
5
15
|
* Update the RSpec example persistence file after each run. Thanks @bagedevimo.
|
|
@@ -14,12 +24,12 @@
|
|
|
14
24
|
|
|
15
25
|
## 2.4.0
|
|
16
26
|
|
|
17
|
-
* Wrap Exception objects so they can always be dumped and loaded, even if they contain non-marshallable objects such as
|
|
27
|
+
* Wrap `Exception` objects so they can always be dumped and loaded, even if they contain non-marshallable objects such as `Proc`s or anonymous classes.
|
|
18
28
|
|
|
19
29
|
## 2.3.0
|
|
20
30
|
|
|
21
31
|
* Increase default workers from 2 to 4.
|
|
22
|
-
* Fix behavioral inconsistency with rspec-core in nested describe blocks on helper methods with clashing let methods.
|
|
32
|
+
* Fix behavioral inconsistency with rspec-core in nested describe blocks on helper methods with clashing `let` methods.
|
|
23
33
|
|
|
24
34
|
## 2.2.0
|
|
25
35
|
|
|
@@ -35,13 +45,13 @@
|
|
|
35
45
|
|
|
36
46
|
## 2.1.0
|
|
37
47
|
|
|
38
|
-
* Add a default parallel_rspec rake task.
|
|
39
|
-
* Add task descriptions for rake --tasks
|
|
48
|
+
* Add a default `parallel_rspec` rake task.
|
|
49
|
+
* Add task descriptions for `rake --tasks`.
|
|
40
50
|
|
|
41
51
|
## 2.0.0
|
|
42
52
|
|
|
43
53
|
* Remove an unnecessary dev dependency to pacify dependabot.
|
|
44
|
-
* Add after_fork hook and running
|
|
54
|
+
* Add `after_fork` hook and `running?` method. Thanks @mogest.
|
|
45
55
|
* Upgrade for compatibility with Rails 6.1 and RSpec 3.10. Thanks @mogest.
|
|
46
56
|
|
|
47
57
|
## 1.2.0
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ParallelRSpec
|
|
2
2
|
|
|
3
|
-
This gem lets you run your RSpec examples in parallel across
|
|
3
|
+
This gem lets you run your RSpec examples in parallel across your CPUs. Each worker gets its own database to avoid conflicts.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -96,6 +96,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/willbr
|
|
|
96
96
|
* Charles Horn (@hornc)
|
|
97
97
|
* Roger Nesbitt (@mogest)
|
|
98
98
|
* Erik Paasonen (@erikpaasonen)
|
|
99
|
+
* Peter Retzlaff (@peret)
|
|
99
100
|
|
|
100
101
|
|
|
101
102
|
## License
|
|
@@ -103,4 +104,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/willbr
|
|
|
103
104
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
104
105
|
|
|
105
106
|
Copyright (c) Powershop New Zealand Ltd, 2015.
|
|
106
|
-
Copyright (c) Will Bryant, 2023.
|
|
107
|
+
Copyright (c) Will Bryant, 2023.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require "rspec/support/caller_filter"
|
|
2
|
+
|
|
3
|
+
if RSpec.const_defined?(:CallerFilter) && RSpec::CallerFilter.const_defined?(:IGNORE_REGEX)
|
|
4
|
+
module RSpec
|
|
5
|
+
class CallerFilter
|
|
6
|
+
_ignore_regex = Regexp.union(IGNORE_REGEX, "/lib/parallel_rspec", "parallel_rspec/exe/prspec")
|
|
7
|
+
remove_const :IGNORE_REGEX
|
|
8
|
+
IGNORE_REGEX = _ignore_regex
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require "rspec/core"
|
|
2
|
+
|
|
1
3
|
module ParallelRSpec
|
|
2
4
|
# Some Exception objects contain non-marshallable ivars such as Proc objects. This wrapper
|
|
3
5
|
# represents the bits needed by RSpec's ExceptionPresenter, and can be dumped and loaded.
|
|
@@ -28,6 +30,20 @@ module ParallelRSpec
|
|
|
28
30
|
end
|
|
29
31
|
end
|
|
30
32
|
|
|
33
|
+
class MultipleExceptionMarshallingWrapper < ExceptionMarshallingWrapper
|
|
34
|
+
include ::RSpec::Core::MultipleExceptionError::InterfaceTag
|
|
35
|
+
|
|
36
|
+
attr_reader :all_exceptions, :aggregation_block_label, :aggregation_metadata, :exception_count_description
|
|
37
|
+
|
|
38
|
+
def initialize(class_name, message, backtrace, cause, all_exceptions, aggregation_block_label, aggregation_metadata, exception_count_description)
|
|
39
|
+
super(class_name, message, backtrace, cause)
|
|
40
|
+
@all_exceptions = all_exceptions
|
|
41
|
+
@aggregation_block_label = aggregation_block_label
|
|
42
|
+
@aggregation_metadata = aggregation_metadata
|
|
43
|
+
@exception_count_description = exception_count_description
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
31
47
|
class Client
|
|
32
48
|
attr_reader :channel_to_server
|
|
33
49
|
|
|
@@ -35,14 +51,6 @@ module ParallelRSpec
|
|
|
35
51
|
@channel_to_server = channel_to_server
|
|
36
52
|
end
|
|
37
53
|
|
|
38
|
-
def example_group_started(group)
|
|
39
|
-
# not implemented yet - would need the same extraction/simplification for serialization as Example below
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def example_group_finished(group)
|
|
43
|
-
# ditto
|
|
44
|
-
end
|
|
45
|
-
|
|
46
54
|
def example_started(example)
|
|
47
55
|
channel_to_server.write([:example_started, example.id, updates_from(example)])
|
|
48
56
|
end
|
|
@@ -80,8 +88,30 @@ module ParallelRSpec
|
|
|
80
88
|
end
|
|
81
89
|
|
|
82
90
|
def dumpable_exception(exception)
|
|
83
|
-
|
|
84
|
-
|
|
91
|
+
case exception
|
|
92
|
+
when nil
|
|
93
|
+
nil
|
|
94
|
+
when ExceptionMarshallingWrapper
|
|
95
|
+
exception
|
|
96
|
+
when ::RSpec::Core::MultipleExceptionError::InterfaceTag
|
|
97
|
+
MultipleExceptionMarshallingWrapper.new(
|
|
98
|
+
exception.class.name,
|
|
99
|
+
exception.message,
|
|
100
|
+
exception.backtrace,
|
|
101
|
+
dumpable_exception(exception.cause),
|
|
102
|
+
exception.all_exceptions.map { |exception| dumpable_exception(exception) },
|
|
103
|
+
exception.aggregation_block_label,
|
|
104
|
+
exception.aggregation_metadata,
|
|
105
|
+
exception.exception_count_description,
|
|
106
|
+
)
|
|
107
|
+
else
|
|
108
|
+
ExceptionMarshallingWrapper.new(
|
|
109
|
+
exception.class.name,
|
|
110
|
+
exception.message,
|
|
111
|
+
exception.backtrace,
|
|
112
|
+
dumpable_exception(exception.cause),
|
|
113
|
+
)
|
|
114
|
+
end
|
|
85
115
|
end
|
|
86
116
|
|
|
87
117
|
def next_example_to_run
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module ParallelRSpec
|
|
2
2
|
class Server
|
|
3
|
-
attr_reader :reporter, :remaining_examples_by_group, :running_examples
|
|
3
|
+
attr_reader :reporter, :remaining_examples_by_group, :running_examples, :top_level_groups
|
|
4
4
|
|
|
5
5
|
def initialize(reporter)
|
|
6
6
|
@remaining_examples_by_group = RSpec.world.filtered_examples.each_with_object({}) do |(example_group, examples), results|
|
|
@@ -9,14 +9,34 @@ module ParallelRSpec
|
|
|
9
9
|
@reporter = reporter
|
|
10
10
|
@success = true
|
|
11
11
|
@running_examples = {}
|
|
12
|
+
@top_level_groups = @remaining_examples_by_group.each_with_object({}) do |(group, examples), results|
|
|
13
|
+
results[top_level(group)] ||= { started: false, count: 0 }
|
|
14
|
+
results[top_level(group)][:count] += examples.size
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def report_example_group_started(group)
|
|
19
|
+
top_level_group = top_level(group)
|
|
20
|
+
return if top_level_groups[top_level_group][:started] # already reported as started
|
|
21
|
+
|
|
22
|
+
top_level_groups[top_level_group][:started] = true
|
|
23
|
+
reporter.example_group_started(top_level_group)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def report_example_group_finished(group)
|
|
27
|
+
top_level_group = top_level(group)
|
|
28
|
+
top_level_groups[top_level_group][:count] -= 1
|
|
29
|
+
reporter.example_group_finished(top_level_group) if top_level_groups[top_level_group][:count].zero?
|
|
12
30
|
end
|
|
13
31
|
|
|
14
32
|
def example_started(example_id, example_updates, channel_to_client)
|
|
15
33
|
reporter.example_started(update_example(running_examples[example_id], example_updates))
|
|
34
|
+
report_example_group_started(running_examples[example_id].example_group)
|
|
16
35
|
end
|
|
17
36
|
|
|
18
37
|
def example_finished(example_id, example_updates, channel_to_client)
|
|
19
38
|
reporter.example_finished(update_example(running_examples[example_id], example_updates))
|
|
39
|
+
report_example_group_finished(running_examples[example_id].example_group)
|
|
20
40
|
end
|
|
21
41
|
|
|
22
42
|
def example_passed(example_id, example_updates, channel_to_client)
|
|
@@ -36,7 +56,7 @@ module ParallelRSpec
|
|
|
36
56
|
end
|
|
37
57
|
|
|
38
58
|
def next_example_to_run(channel_to_client)
|
|
39
|
-
if remaining_examples_by_group.empty?
|
|
59
|
+
if remaining_examples_by_group.empty? || reporter.fail_fast_limit_met?
|
|
40
60
|
channel_to_client.write(nil)
|
|
41
61
|
else
|
|
42
62
|
example_group = remaining_examples_by_group.keys.first
|
|
@@ -60,5 +80,11 @@ module ParallelRSpec
|
|
|
60
80
|
example.metadata.merge!(data[:metadata])
|
|
61
81
|
example
|
|
62
82
|
end
|
|
83
|
+
|
|
84
|
+
private
|
|
85
|
+
|
|
86
|
+
def top_level(example_group)
|
|
87
|
+
example_group.parent_groups.last
|
|
88
|
+
end
|
|
63
89
|
end
|
|
64
90
|
end
|
data/lib/parallel_rspec.rb
CHANGED
|
@@ -5,6 +5,7 @@ require "parallel_rspec/workers"
|
|
|
5
5
|
require "parallel_rspec/example"
|
|
6
6
|
require "parallel_rspec/server"
|
|
7
7
|
require "parallel_rspec/client"
|
|
8
|
+
require "parallel_rspec/caller_filter_patch"
|
|
8
9
|
require "parallel_rspec/rake_task"
|
|
9
10
|
require "parallel_rspec/runner"
|
|
10
11
|
require "parallel_rspec/railtie"
|
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:
|
|
4
|
+
version: 3.0.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:
|
|
11
|
+
date: 2026-01-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -57,6 +57,7 @@ files:
|
|
|
57
57
|
- Rakefile
|
|
58
58
|
- exe/prspec
|
|
59
59
|
- lib/parallel_rspec.rb
|
|
60
|
+
- lib/parallel_rspec/caller_filter_patch.rb
|
|
60
61
|
- lib/parallel_rspec/channel.rb
|
|
61
62
|
- lib/parallel_rspec/client.rb
|
|
62
63
|
- lib/parallel_rspec/config.rb
|