Sha256: 673a3a8f65b886762b4be24c28b6ef17ad869e186c4ffec2bb0b3a3cd23db640

Contents?: true

Size: 1.29 KB

Versions: 19

Compression:

Stored size: 1.29 KB

Contents

require "yaml"
require "parallel_tests/rspec/runner"

module ParallelTests
  module Saucerspec
    class Runner < ParallelTests::RSpec::Runner

      def self.run_tests(test_files, process_number, num_processes, options)
        our_options = options.dup
        exe = executable # expensive, so we cache
        version = (exe =~ /\brspec\b/ ? 2 : 1)
        cmd = [exe, our_options[:test_options], (rspec_2_color if version == 2), spec_opts, *test_files].compact.join(" ")
        env = Sauce::TestBroker.next_environment(test_files)
        env << " #{rspec_1_color}" if version == 1
        our_options.merge!(:env => env)
        execute_command(cmd, process_number, num_processes, our_options)
      end


      def self.tests_in_groups(tests, num_groups, options={})
        all_tests = super.flatten * Sauce::TestBroker.test_platforms(:rspec).length
        base_group_size = all_tests.length / num_groups
        num_full_groups = all_tests.length - (base_group_size * num_groups)

        curpos = 0
        groups = []
        num_groups.times do |i|
          group_size = base_group_size
          if i < num_full_groups
            group_size += 1
          end
          groups << all_tests.slice(curpos, group_size)
          curpos += group_size
        end

        groups
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
sauce_ruby-3.5.11 lib/parallel_tests/saucerspec/runner.rb
sauce_ruby-3.5.10 lib/parallel_tests/saucerspec/runner.rb
sauce_ruby-3.5.9 lib/parallel_tests/saucerspec/runner.rb
sauce_ruby-3.5.8 lib/parallel_tests/saucerspec/runner.rb
sauce_ruby-3.5.7 lib/parallel_tests/saucerspec/runner.rb
sauce_ruby-3.5.6 lib/parallel_tests/saucerspec/runner.rb
sauce-3.5.6 lib/parallel_tests/saucerspec/runner.rb
sauce-3.5.5 lib/parallel_tests/saucerspec/runner.rb
sauce-3.5.4 lib/parallel_tests/saucerspec/runner.rb
sauce-3.5.3 lib/parallel_tests/saucerspec/runner.rb
sauce-3.5.2 lib/parallel_tests/saucerspec/runner.rb
sauce-3.5.1 lib/parallel_tests/saucerspec/runner.rb
sauce-3.5.0 lib/parallel_tests/saucerspec/runner.rb
sauce-3.4.9 lib/parallel_tests/saucerspec/runner.rb
sauce-3.4.8 lib/parallel_tests/saucerspec/runner.rb
sauce-3.4.7 lib/parallel_tests/saucerspec/runner.rb
sauce-3.4.6 lib/parallel_tests/saucerspec/runner.rb
sauce-3.4.5 lib/parallel_tests/saucerspec/runner.rb
sauce-3.4.4 lib/parallel_tests/saucerspec/runner.rb