class ParallelTests::Test::Runner
def tests_in_groups(tests, num_groups, options={})
def tests_in_groups(tests, num_groups, options={}) tests = find_tests(tests, options) case options[:group_by] when :found tests.map! { |t| [t, 1] } when :filesize sort_by_filesize(tests) when :runtime sort_by_runtime(tests, runtimes(options), options.merge(allowed_missing: 0.5)) when nil # use recorded test runtime if we got enough data runtimes = runtimes(options) rescue [] if runtimes.size * 1.5 > tests.size puts "Using recorded test runtime" sort_by_runtime(tests, runtimes) else sort_by_filesize(tests) end else raise ArgumentError, "Unsupported option #{options[:group_by]}" end Grouper.in_even_groups_by_size(tests, num_groups, options) end