class ParallelTests

def self.find_tests_with_sizes(root)

def self.find_tests_with_sizes(root)
  tests = find_tests(root).sort
  #TODO get the real root, atm this only works for complete runs when root point to e.g. real_root/spec
  runtime_file = File.join(root,'..','tmp','parallel_profile.log')
  lines = File.read(runtime_file).split("\n") rescue []
  if lines.size * 1.5 > tests.size
    # use recorded test runtime if we got enough data
    times = Hash.new(1)
    lines.each do |line|
      test, time = line.split(":")
      times[test] = time.to_f
    end
    tests.map { |test| [ test, times[test] ] }
  else
    # use file sizes
    tests.map { |test| [ test, File.stat(test).size ] }
  end
end