parallel_rspec 2.1.2 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +9 -0
- data/README.md +8 -4
- data/lib/parallel_rspec/client.rb +12 -26
- data/lib/parallel_rspec/runner.rb +1 -1
- data/lib/parallel_rspec/server.rb +26 -19
- data/lib/parallel_rspec/version.rb +1 -1
- data/lib/parallel_rspec/workers.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7a38c7f6a685aef852543e1c676aae48e0066fd98f5b6b51c3ca44ca1b8b3b0
|
4
|
+
data.tar.gz: 98b98c46b8ef5f8b60066a838b9e58b2df26cd2501086c86d2d7966adb2972cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79ab6a5abf73b8c8a788dd45626aa22d25284af00c4146ef9fa0a174adb7d1c648f5fde0399ecbca5f6103df17bd70c389ee22a9b05e88da9a98a463ee39ca21
|
7
|
+
data.tar.gz: 31d2d263fa915de652ce0e990b23387d3946ee1d72d265ba3ec8242a6b483cc2b0d095e02b803614a94ce5bd00a363c74714d147ddb66da2c2bef60e892d52a0
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 2.3.0
|
4
|
+
|
5
|
+
* Increase default workers from 2 to 4.
|
6
|
+
* Fix behavioral inconsistency with rspec-core in nested describe blocks on helper methods with clashing let methods.
|
7
|
+
|
8
|
+
## 2.2.0
|
9
|
+
|
10
|
+
* Fix incompatibility with `rspec --profile`.
|
11
|
+
|
3
12
|
## 2.1.2
|
4
13
|
|
5
14
|
* Fix error when used in projects without ActiveSupport. Thanks @erikpaasonen.
|
data/README.md
CHANGED
@@ -24,13 +24,13 @@ And then execute:
|
|
24
24
|
|
25
25
|
$ bundle
|
26
26
|
|
27
|
-
This version of ParallelRSpec has been tested with RSpec 3.
|
27
|
+
This version of ParallelRSpec has been tested with RSpec 3.12.
|
28
28
|
|
29
29
|
## Usage
|
30
30
|
|
31
|
-
By default, ParallelRSpec will use
|
31
|
+
By default, ParallelRSpec will use four workers. If you would like to use more, set an environment variable:
|
32
32
|
|
33
|
-
$ export WORKERS=
|
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'] = '
|
62
|
+
ENV['WORKERS'] = '8'
|
63
63
|
t.pattern = "spec/**/*_spec.rb"
|
64
64
|
t.rspec_opts = "--tag parallel"
|
65
65
|
# etc...
|
@@ -82,6 +82,10 @@ You might also want to detect whether your spec suite is running under ParallelR
|
|
82
82
|
do_something unless ParallelRSpec.running?
|
83
83
|
```
|
84
84
|
|
85
|
+
## Limitations
|
86
|
+
|
87
|
+
ParallelRSpec can't parallelize the specs in groups that use `before(:context)` or `after(:context)` (AKA `before(:all)` or `after(:all)`) hooks, since these may mean that there is state shared between examples.
|
88
|
+
|
85
89
|
## Contributing
|
86
90
|
|
87
91
|
Bug reports and pull requests are welcome on GitHub at https://github.com/willbryant/parallel_rspec.
|
@@ -15,52 +15,38 @@ module ParallelRSpec
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def example_started(example)
|
18
|
-
channel_to_server.write([:example_started,
|
18
|
+
channel_to_server.write([:example_started, example.id, updates_from(example)])
|
19
19
|
end
|
20
20
|
|
21
21
|
def example_passed(example)
|
22
|
-
channel_to_server.write([:example_passed,
|
22
|
+
channel_to_server.write([:example_passed, example.id, updates_from(example)])
|
23
23
|
end
|
24
24
|
|
25
25
|
def example_failed(example)
|
26
|
-
channel_to_server.write([:example_failed,
|
26
|
+
channel_to_server.write([:example_failed, example.id, updates_from(example)])
|
27
27
|
end
|
28
28
|
|
29
29
|
def example_finished(example)
|
30
|
-
channel_to_server.write([:example_finished,
|
30
|
+
channel_to_server.write([:example_finished, example.id, updates_from(example)])
|
31
31
|
end
|
32
32
|
|
33
33
|
def example_pending(example)
|
34
|
-
channel_to_server.write([:example_pending,
|
34
|
+
channel_to_server.write([:example_pending, example.id, updates_from(example)])
|
35
35
|
end
|
36
36
|
|
37
37
|
def deprecation(hash)
|
38
38
|
channel_to_server.write([:deprecation, hash])
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
42
|
-
|
43
|
-
example.
|
44
|
-
example.
|
45
|
-
example.exception,
|
46
|
-
example.location_rerun_argument,
|
47
|
-
ExampleGroup.new([]),
|
48
|
-
example.metadata.slice(
|
49
|
-
:absolute_file_path,
|
50
|
-
:described_class,
|
51
|
-
:description,
|
52
|
-
:description_args,
|
41
|
+
def updates_from(example)
|
42
|
+
{
|
43
|
+
exception: example.exception,
|
44
|
+
metadata: example.metadata.slice(
|
53
45
|
:execution_result,
|
54
|
-
:full_description,
|
55
|
-
:file_path,
|
56
|
-
:last_run_status,
|
57
|
-
:line_number,
|
58
|
-
:location,
|
59
46
|
:pending,
|
60
|
-
:
|
61
|
-
|
62
|
-
|
63
|
-
:type))
|
47
|
+
:skip,
|
48
|
+
)
|
49
|
+
}
|
64
50
|
end
|
65
51
|
|
66
52
|
def next_example_to_run
|
@@ -58,7 +58,6 @@ module ParallelRSpec
|
|
58
58
|
# or the configured failure exit code (1 by default) if specs
|
59
59
|
# failed.
|
60
60
|
def run_specs(example_groups)
|
61
|
-
puts "running #{@world.example_count(example_groups)}"
|
62
61
|
@configuration.reporter.report(@world.example_count(example_groups)) do |reporter|
|
63
62
|
@configuration.with_suite_hooks do
|
64
63
|
with_context_hooks, without_context_hooks = example_groups.partition(&:any_context_hooks?)
|
@@ -78,6 +77,7 @@ module ParallelRSpec
|
|
78
77
|
while next_example = client.next_example_to_run
|
79
78
|
example_group, example_index = *next_example
|
80
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") }
|
81
81
|
example_group_instance = example_group.new(example.inspect_output)
|
82
82
|
success = example.run(example_group_instance, client) && success
|
83
83
|
end
|
@@ -1,34 +1,34 @@
|
|
1
1
|
module ParallelRSpec
|
2
2
|
class Server
|
3
|
-
attr_reader :
|
3
|
+
attr_reader :reporter, :remaining_examples_by_group, :running_examples
|
4
4
|
|
5
5
|
def initialize(reporter)
|
6
|
-
@
|
7
|
-
results[example_group] = examples
|
6
|
+
@remaining_examples_by_group = RSpec.world.filtered_examples.each_with_object({}) do |(example_group, examples), results|
|
7
|
+
results[example_group] = examples unless example_group.any_context_hooks? || examples.size.zero?
|
8
8
|
end
|
9
9
|
@reporter = reporter
|
10
10
|
@success = true
|
11
|
+
@running_examples = {}
|
11
12
|
end
|
12
13
|
|
13
|
-
def example_started(
|
14
|
-
reporter.example_started(
|
14
|
+
def example_started(example_id, example_updates, channel_to_client)
|
15
|
+
reporter.example_started(update_example(running_examples[example_id], example_updates))
|
15
16
|
end
|
16
17
|
|
17
|
-
def
|
18
|
-
reporter.
|
18
|
+
def example_finished(example_id, example_updates, channel_to_client)
|
19
|
+
reporter.example_finished(update_example(running_examples[example_id], example_updates))
|
19
20
|
end
|
20
21
|
|
21
|
-
def
|
22
|
-
reporter.
|
22
|
+
def example_passed(example_id, example_updates, channel_to_client)
|
23
|
+
reporter.example_passed(update_example(running_examples.delete(example_id), example_updates))
|
23
24
|
end
|
24
25
|
|
25
|
-
def
|
26
|
-
|
27
|
-
reporter.example_finished(example)
|
26
|
+
def example_failed(example_id, example_updates, channel_to_client)
|
27
|
+
reporter.example_failed(update_example(running_examples.delete(example_id), example_updates))
|
28
28
|
end
|
29
29
|
|
30
|
-
def example_pending(
|
31
|
-
reporter.example_pending(
|
30
|
+
def example_pending(example_id, example_updates, channel_to_client)
|
31
|
+
reporter.example_pending(update_example(running_examples.delete(example_id), example_updates))
|
32
32
|
end
|
33
33
|
|
34
34
|
def deprecation(hash, channel_to_client)
|
@@ -36,13 +36,14 @@ module ParallelRSpec
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def next_example_to_run(channel_to_client)
|
39
|
-
if
|
39
|
+
if remaining_examples_by_group.empty?
|
40
40
|
channel_to_client.write(nil)
|
41
41
|
else
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
example_group = remaining_examples_by_group.keys.first
|
43
|
+
example = remaining_examples_by_group[example_group].pop
|
44
|
+
running_examples[example.id] = example # cache so we don't need to look through all the examples for each message
|
45
|
+
channel_to_client.write([example_group, remaining_examples_by_group[example_group].size])
|
46
|
+
remaining_examples_by_group.delete(example_group) if remaining_examples_by_group[example_group].empty?
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
@@ -53,5 +54,11 @@ module ParallelRSpec
|
|
53
54
|
def success?
|
54
55
|
@success
|
55
56
|
end
|
57
|
+
|
58
|
+
def update_example(example, data)
|
59
|
+
example.set_exception(data[:exception])
|
60
|
+
example.metadata.merge!(data[:metadata])
|
61
|
+
example
|
62
|
+
end
|
56
63
|
end
|
57
64
|
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.
|
4
|
+
version: 2.3.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-
|
11
|
+
date: 2023-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|