parallel_tests 1.3.2 → 1.3.3

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: eb03b149858850d173e253b5f221955c78308d31
4
- data.tar.gz: 2b7ab7a8bc2404f4753d098becf7d317470e4a5b
3
+ metadata.gz: 8c3c5c94b8591531e20c448d8b7ae8e7018146db
4
+ data.tar.gz: d729a288963d0bf4aafbfde3bcb5d664de561b3e
5
5
  SHA512:
6
- metadata.gz: 3505c81d9d74cded2d43af6c94260d06090e2d0aff0b10ea49af3f2411471190ea84516841c2a5df819cea1fe437320b4711e3beaf98a0d9fd40aac813a36ded
7
- data.tar.gz: f1e93029650eca41352d4b5feac1fc663a6405ec6daef96116f24b58ae1f274bbdf906da26cabcf6151b72abd6a949b55cb3a3f974f3997ad7f8b91957b83768
6
+ metadata.gz: 5448b82c0a3cf89b5d41a5e179c3260126602a62a377eb53009cb758815018a952293656d60b577854761cbb2e5b77d02ee3af1ae92c7c7f1cb34e0fe855164f
7
+ data.tar.gz: cda7473b6fd14fc9d55da4ee7fb84c50bbece107ea430a2230a38c6f10db8bfe8d6467ab2a8fb75791b7b4d26bba29812d50057dece0e220568d444b891a84ae
@@ -47,7 +47,7 @@ module ParallelTests
47
47
  when :filesize
48
48
  sort_by_filesize(tests)
49
49
  when :runtime
50
- sort_by_runtime(tests, runtimes(options), allowed_missing: 0.5)
50
+ sort_by_runtime(tests, runtimes(options), options.merge(allowed_missing: 0.5))
51
51
  when nil
52
52
  # use recorded test runtime if we got enough data
53
53
  runtimes = runtimes(options) rescue []
@@ -153,6 +153,7 @@ module ParallelTests
153
153
  allowed_missing = options[:allowed_missing] || 1.0
154
154
  allowed_missing = tests.size * allowed_missing
155
155
 
156
+ # build runtime hash
156
157
  times = {}
157
158
  runtimes.each do |line|
158
159
  test, time = line.split(":", 2)
@@ -160,12 +161,22 @@ module ParallelTests
160
161
  times[test] = time.to_f
161
162
  end
162
163
 
164
+ # set know runtime for each test
163
165
  tests.sort!
164
166
  tests.map! do |test|
165
167
  allowed_missing -= 1 unless time = times[test]
166
168
  raise "Too little runtime info" if allowed_missing < 0
167
- [test, time || 1]
169
+ [test, time]
168
170
  end
171
+
172
+ if options[:verbose]
173
+ puts "Runtime found for #{tests.count(&:last)} of #{tests.size} tests"
174
+ end
175
+
176
+ # fill gaps with average runtime
177
+ known, unknown = tests.partition(&:last)
178
+ average = known.map!(&:last).inject(:+) / known.size
179
+ unknown.each { |set| set[1] = average }
169
180
  end
170
181
 
171
182
  def runtimes(options)
@@ -1,3 +1,3 @@
1
1
  module ParallelTests
2
- VERSION = Version = '1.3.2'
2
+ VERSION = Version = '1.3.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser