parallel_rspec 2.4.2 → 2.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ff66f78e121832aa63d701f6ccdbad7f0e76747920fdb570a0dac970f5751d6
4
- data.tar.gz: 78f43be514c147aee8da49aa1daf96d5c4696c98a04fa077c771c11d371e3a95
3
+ metadata.gz: 2a9882673bf7a63db2cf0e99d04ddf76baf37a1423ffed5e5b7cd7a9a40bbbb3
4
+ data.tar.gz: cef36e60b39e5500249b3c1c12cfd9f0bb985c39a5e80207b028428da81aeb08
5
5
  SHA512:
6
- metadata.gz: ff8609608db21a3f68ee998eb2d049852a4b38237b655b6cf7654f5cc9d2c0d45169485dd56c9f5db8df45e0461b8f6f7f8e7d42b2e12514ca66a4a451d4be7e
7
- data.tar.gz: 6c99ff616b0c5b3d56bbf53469802e04c897beb18bb9f7f04a4a44de91fd863648ecddfb2e4d36046655611cb98931db5c601c2dcba4a55d58cb85b636024b50
6
+ metadata.gz: 0cac3c2057c28687d434ad6ed21aa378089f6132e4948c154b998a4ba0e735d2d5a69d3983231abc2b76841dc004474cf97f60afe13d18e3a8dbec747744f14b
7
+ data.tar.gz: 605f72e97c9ca1ae86bc20511c2735de32e59dafef6fa17566d7b3eaa29bc3610f669e98185424f70f86c57e210e0591e7deef8b7441e4e4294390ee34d60ce7
data/CHANGES.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.6.0
4
+
5
+ * Fix `--profile` support. Thanks @peret.
6
+
7
+ ## 2.5.0
8
+
9
+ * Update the RSpec example persistence file after each run. Thanks @bagedevimo.
10
+
3
11
  ## 2.4.2
4
12
 
5
13
  * Fix more calls to deprecated `ActiveRecord::Base.configurations[]`.
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 across your CPUs. Each worker gets its own database to avoid conflicts.
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.
@@ -35,14 +35,6 @@ module ParallelRSpec
35
35
  @channel_to_server = channel_to_server
36
36
  end
37
37
 
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
38
  def example_started(example)
47
39
  channel_to_server.write([:example_started, example.id, updates_from(example)])
48
40
  end
@@ -63,6 +63,9 @@ module ParallelRSpec
63
63
  with_context_hooks, without_context_hooks = example_groups.partition(&:any_context_hooks?)
64
64
  success = run_in_parallel(without_context_hooks, reporter)
65
65
  success &&= with_context_hooks.map { |g| g.run(reporter) }.all?
66
+
67
+ persist_example_statuses
68
+
66
69
  success ? 0 : @configuration.failure_exit_code
67
70
  end
68
71
  end
@@ -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)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ParallelRSpec
2
- VERSION = "2.4.2"
2
+ VERSION = "2.6.0"
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.4.2
4
+ version: 2.6.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: 2025-01-13 00:00:00.000000000 Z
11
+ date: 2025-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake