Exemple #1
0
    def make_test_batches(self, test_list):
        sorted_tests = []
        for e in test_list.tests_by_exe.values():
            for tst in e:
                sorted_tests.append(tst)

        # slowest tests first, then group tests by the same exe
        sorted_tests.sort(key=lambda tst: (-tst.duration, tst.exe_name))

        result = []
        batch = None
        for tst in sorted_tests:
            if not batch:
                batch = Batch(len(result))
                result.append(batch)
                should_add = True
            else:
                should_add = batch.total_duration() < self.wished_duration
            if not should_add:
                batch = Batch(len(result))
                result.append(batch)
            batch.add_test(tst)
        return result