parallel_tests 2.13.0 → 2.14.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
  SHA1:
3
- metadata.gz: 8c5093d00208e78bd29823d73e12a7409588adbd
4
- data.tar.gz: f937ad2c7a3036ceda12fd4d2e432c45c5209822
3
+ metadata.gz: f326996fc88803c4f76b9e184aa5bf2c1150e4d4
4
+ data.tar.gz: a4aa419cef3d0af3cc401082bd462028b8fbd825
5
5
  SHA512:
6
- metadata.gz: 61241e2a1133c15307e8b50ac845aa0655c2120a98356e4bd08e1e14fbfbbd5b7bde367e55e934ad538183f9daa3b83707613d933136805130a30612a7d76355
7
- data.tar.gz: 1f7a44c636ade949d48cec7253186f3be7052cf9fdd711004060e445ed0b357d1263ddd010d5abae318f683ae46a5eab5900e6c6d7e00d8648c9786165ab47d2
6
+ metadata.gz: b81bfb8d8ddeb59c8383b1e5eda35ff3cddb0923d66efb38d548076d3629b7b1558029de0b8a28b27a6c071a788b56dd3d9655f1bcb44b11d4ce73c05f4263dc
7
+ data.tar.gz: d8598855d1e18ee95dad3540ef49015da0ce51836a7e3f90e904d7274993ac7c4c1bb3aeaa000a46af8e4d0f383874ded46a0466dfbbf1e648743eb5ee5d077f
data/Readme.md CHANGED
@@ -359,6 +359,7 @@ inspired by [pivotal labs](https://blog.pivotal.io/labs/labs/parallelize-your-rs
359
359
  - [Rhett Sutphin](https://github.com/rsutphin)
360
360
  - [Doc Ritezel](https://github.com/ohrite)
361
361
  - [Alexandre Wilhelm](https://github.com/dogild)
362
+ - [Jerry](https://github.com/boblington)
362
363
 
363
364
 
364
365
  [Michael Grosser](http://grosser.it)<br/>
@@ -2,20 +2,7 @@ require 'parallel_tests/rspec/logger_base'
2
2
  require 'parallel_tests/rspec/runner'
3
3
 
4
4
  class ParallelTests::RSpec::FailuresLogger < ParallelTests::RSpec::LoggerBase
5
- if RSPEC_1
6
- # RSpec 1: does not keep track of failures, so we do
7
- def example_failed(example, *args)
8
- if RSPEC_1
9
- @failed_examples ||= []
10
- @failed_examples << example
11
- else
12
- super
13
- end
14
- end
15
-
16
- def dump_failure(*args)
17
- end
18
- elsif RSPEC_2
5
+ if RSPEC_2
19
6
  def dump_failures(*args)
20
7
  end
21
8
  else
@@ -24,29 +11,16 @@ class ParallelTests::RSpec::FailuresLogger < ParallelTests::RSpec::LoggerBase
24
11
 
25
12
  def dump_summary(*args)
26
13
  lock_output do
27
- if RSPEC_1
28
- dump_commands_to_rerun_failed_examples_rspec_1
29
- elsif RSPEC_3
14
+ if RSPEC_2
15
+ dump_commands_to_rerun_failed_examples
16
+ else
30
17
  notification = args.first
31
18
  unless notification.failed_examples.empty?
32
19
  colorizer = ::RSpec::Core::Formatters::ConsoleCodes
33
20
  output.puts notification.colorized_rerun_commands(colorizer)
34
21
  end
35
- else
36
- dump_commands_to_rerun_failed_examples
37
22
  end
38
23
  end
39
24
  @output.flush
40
25
  end
41
-
42
- private
43
-
44
- def dump_commands_to_rerun_failed_examples_rspec_1
45
- (@failed_examples||[]).each do |example|
46
- file, line = example.location.to_s.split(':')
47
- next unless file and line
48
- file.gsub!(%r(^.*?/spec/), './spec/')
49
- @output.puts "#{ParallelTests::RSpec::Runner.send(:executable)} #{file}:#{line} # #{example.description}"
50
- end
51
- end
52
26
  end
@@ -3,25 +3,15 @@ module ParallelTests
3
3
  end
4
4
  end
5
5
 
6
- begin
7
- require 'rspec/core/formatters/base_text_formatter'
8
- base = RSpec::Core::Formatters::BaseTextFormatter
9
- rescue LoadError
10
- require 'spec/runner/formatter/base_text_formatter'
11
- base = Spec::Runner::Formatter::BaseTextFormatter
12
- end
13
-
14
- ParallelTests::RSpec::LoggerBaseBase = base
6
+ require 'rspec/core/formatters/base_text_formatter'
15
7
 
16
- class ParallelTests::RSpec::LoggerBase < ParallelTests::RSpec::LoggerBaseBase
17
- RSPEC_1 = !defined?(RSpec::Core::Formatters::BaseTextFormatter) # do not test for Spec, this will trigger deprecation warning in rspec 2
18
- RSPEC_2 = !RSPEC_1 && RSpec::Core::Version::STRING.start_with?('2')
19
- RSPEC_3 = !RSPEC_1 && RSpec::Core::Version::STRING.start_with?('3')
8
+ class ParallelTests::RSpec::LoggerBase < RSpec::Core::Formatters::BaseTextFormatter
9
+ RSPEC_2 = RSpec::Core::Version::STRING.start_with?('2')
20
10
 
21
11
  def initialize(*args)
22
12
  super
23
13
 
24
- @output ||= args[1] || args[0] # rspec 1 has output as second argument
14
+ @output ||= args[0]
25
15
 
26
16
  if String === @output # a path ?
27
17
  FileUtils.mkdir_p(File.dirname(@output))
@@ -9,9 +9,7 @@ module ParallelTests
9
9
  class << self
10
10
  def run_tests(test_files, process_number, num_processes, options)
11
11
  exe = executable # expensive, so we cache
12
- version = (exe =~ /\brspec\b/ ? 2 : 1)
13
- cmd = [exe, options[:test_options], (rspec_2_color if version == 2), spec_opts, *test_files].compact.join(" ")
14
- options = options.merge(:env => rspec_1_color) if version == 1
12
+ cmd = [exe, options[:test_options], color, spec_opts, *test_files].compact.join(" ")
15
13
  execute_command(cmd, process_number, num_processes, options)
16
14
  end
17
15
 
@@ -19,8 +17,6 @@ module ParallelTests
19
17
  cmd = case
20
18
  when File.exist?("bin/rspec")
21
19
  WINDOWS ? "ruby bin/rspec" : "bin/rspec"
22
- when File.file?("script/spec")
23
- "script/spec"
24
20
  when ParallelTests.bundler_enabled?
25
21
  cmd = (run("bundle show rspec-core") =~ %r{Could not find gem.*} ? "spec" : "rspec")
26
22
  "bundle exec #{cmd}"
@@ -65,15 +61,7 @@ module ParallelTests
65
61
  `#{cmd}`
66
62
  end
67
63
 
68
- def rspec_1_color
69
- if $stdout.tty?
70
- {'RSPEC_COLOR' => "1"}
71
- else
72
- {}
73
- end
74
- end
75
-
76
- def rspec_2_color
64
+ def color
77
65
  '--color --tty' if $stdout.tty?
78
66
  end
79
67
 
@@ -5,39 +5,26 @@ class ParallelTests::RSpec::RuntimeLogger < ParallelTests::RSpec::LoggerBase
5
5
  def initialize(*args)
6
6
  super
7
7
  @example_times = Hash.new(0)
8
- @group_nesting = 0 unless RSPEC_1
8
+ @group_nesting = 0
9
9
  end
10
10
 
11
- if RSPEC_3
11
+ unless RSPEC_2
12
12
  RSpec::Core::Formatters.register self, :example_group_started, :example_group_finished, :start_dump
13
13
  end
14
14
 
15
- if RSPEC_1
16
- def example_started(*args)
17
- @time = ParallelTests.now
18
- super
19
- end
20
-
21
- def example_passed(example)
22
- file = example.location.split(':').first
23
- @example_times[file] += ParallelTests.now - @time
24
- super
25
- end
26
- else
27
- def example_group_started(example_group)
28
- @time = ParallelTests.now if @group_nesting == 0
29
- @group_nesting += 1
30
- super
31
- end
15
+ def example_group_started(example_group)
16
+ @time = ParallelTests.now if @group_nesting == 0
17
+ @group_nesting += 1
18
+ super
19
+ end
32
20
 
33
- def example_group_finished(notification)
34
- @group_nesting -= 1
35
- if @group_nesting == 0
36
- path = (RSPEC_3 ? notification.group.file_path : notification.file_path)
37
- @example_times[path] += ParallelTests.now - @time
38
- end
39
- super if defined?(super)
21
+ def example_group_finished(notification)
22
+ @group_nesting -= 1
23
+ if @group_nesting == 0
24
+ path = (RSPEC_2 ? notification.file_path : notification.group.file_path)
25
+ @example_times[path] += ParallelTests.now - @time
40
26
  end
27
+ super if defined?(super)
41
28
  end
42
29
 
43
30
  def dump_summary(*args);end
@@ -1,19 +1,12 @@
1
1
  require 'parallel_tests/rspec/failures_logger'
2
2
 
3
3
  class ParallelTests::RSpec::SummaryLogger < ParallelTests::RSpec::LoggerBase
4
- if RSPEC_3
4
+ unless RSPEC_2
5
5
  RSpec::Core::Formatters.register self, :dump_failures
6
6
  end
7
7
 
8
- if RSPEC_1
9
- def dump_failure(*args)
10
- lock_output { super }
11
- @output.flush
12
- end
13
- else
14
- def dump_failures(*args)
15
- lock_output { super }
16
- @output.flush
17
- end
8
+ def dump_failures(*args)
9
+ lock_output { super }
10
+ @output.flush
18
11
  end
19
12
  end
@@ -1,3 +1,3 @@
1
1
  module ParallelTests
2
- VERSION = Version = '2.13.0'
2
+ VERSION = Version = '2.14.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.0
4
+ version: 2.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-12 00:00:00.000000000 Z
11
+ date: 2017-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel