Sha256: 183ff05fecd6f78ddcd6483b3274b254de12941b1fba90c9765b99e6da818e14

Contents?: true

Size: 566 Bytes

Versions: 10

Compression:

Stored size: 566 Bytes

Contents

require 'parallel'

module ParallelSplitTest
  class << self
    attr_accessor :example_counter, :processes, :process_number

    def run_example?
      self.example_counter += 1
      (example_counter - 1) % processes == process_number
    end

    def choose_number_of_processes
      self.processes = best_number_of_processes
    end

    def best_number_of_processes
      [
        ENV['PARALLEL_SPLIT_TEST_PROCESSES'],
        Parallel.physical_processor_count,
        Parallel.processor_count
      ].map(&:to_i).find{|number| number > 0 }
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
parallel_split_test-0.9.1 lib/parallel_split_test.rb
parallel_split_test-0.9.0 lib/parallel_split_test.rb
parallel_split_test-0.8.0 lib/parallel_split_test.rb
parallel_split_test-0.7.0 lib/parallel_split_test.rb
parallel_split_test-0.6.0 lib/parallel_split_test.rb
parallel_split_test-0.5.0 lib/parallel_split_test.rb
parallel_split_test-0.4.1 lib/parallel_split_test.rb
parallel_split_test-0.4.0 lib/parallel_split_test.rb
parallel_split_test-0.3.0 lib/parallel_split_test.rb
parallel_split_test-0.2.1 lib/parallel_split_test.rb