Bug 1182817 - [manifestparser] Fix exception in chunk_by_slice when there are two times more chunks than tests, r=chmanchester

--HG--
extra : commitid : K5KnytkByDT
extra : rebase_source : 502b560240f8319b3955485578705a5319980992
This commit is contained in:
Andrew Halberstadt 2015-07-13 14:38:34 -04:00
Родитель 25767b735d
Коммит cfd7060fa9
2 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -183,12 +183,12 @@ class chunk_by_slice(InstanceFilter):
# chunk will contain an equal number of enabled tests.
if self.this_chunk == 1:
start = 0
else:
elif start < len(chunk_tests):
start = tests.index(chunk_tests[start])
if self.this_chunk == self.total_chunks:
end = len(tests)
else:
elif end < len(chunk_tests):
end = tests.index(chunk_tests[end])
return (t for t in tests[start:end])

Просмотреть файл

@ -66,6 +66,15 @@ class ChunkBySlice(TestCase):
disabled = list(i for i in xrange(num_tests) if i % 4 == 0)
self.run_all_combos(num_tests=num_tests, disabled=disabled)
def test_two_times_more_chunks_than_tests(self):
# test case for bug 1182817
tests = self.generate_tests(5)
total_chunks = 10
for i in range(1, total_chunks + 1):
# ensure IndexError is not raised
chunk_by_slice(i, total_chunks)(tests, {})
class ChunkByDir(TestCase):
"""Test chunking related filters"""