# Path: stestr/repository/memory.py
# class RepositoryFactory(repository.AbstractRepositoryFactory):
# class Repository(repository.AbstractRepository):
# class _Failures(repository.AbstractTestRun):
# class _Inserter(repository.AbstractTestRun):
#     def __init__(self):
#     def initialise(self, url):
#     def open(self, url):
#     def __init__(self):
#     def count(self):
#     def get_failing(self):
#     def get_test_run(self, run_id):
#     def get_run_ids(self):
#     def remove_run_id(self, run_id):
#     def latest_id(self):
#     def _get_inserter(self, partial, run_id=None, metadata=None):
#     def _get_test_times(self, test_ids):
#     def __init__(self, repository):
#     def get_id(self):
#     def get_subunit_stream(self):
#     def get_test(self):
#         def wrap_result(result):
#     def run(self, result):
#     def __init__(self, repository, partial, run_id=None, metadata=None):
#     def startTestRun(self):
#     def _handle_test(self, test_dict):
#     def stopTestRun(self):
#     def status(self, *args, **kwargs):
#     def get_id(self):
#     def get_subunit_stream(self):
#     def get_test(self):
#         def wrap_result(result):
#     def run(self, result):
# 
# Path: stestr/scheduler.py
# def partition_tests(test_ids, concurrency, repository, group_callback,
#                     randomize=False):
#     def noop(_):
#     def consume_queue(groups):
# def local_concurrency():
# def generate_worker_partitions(ids, worker_path, repository=None,
#                                group_callback=None, randomize=False):
# 
# Path: stestr/tests/base.py
# class TestCase(testtools.TestCase):
#     def setUp(self):


import datetime
import re
from unittest import mock
from subunit import iso8601
from stestr.repository import memory
from stestr import scheduler
from stestr.tests import base
                              'unknown2', 'unknown3', 'unknown4'])
        partitions = scheduler.partition_tests(test_ids, 2, repo, None)
        self.assertTrue('slow' in partitions[0])
        self.assertFalse('fast1' in partitions[0])
        self.assertFalse('fast2' in partitions[0])
        self.assertFalse('slow' in partitions[1])
        self.assertTrue('fast1' in partitions[1])
        self.assertTrue('fast2' in partitions[1])
        self.assertEqual(3, len(partitions[0]))
        self.assertEqual(4, len(partitions[1]))

    def test_random_partitions(self):
        repo = memory.RepositoryFactory().initialise('memory:')
        test_ids = frozenset(['a_test', 'b_test', 'c_test', 'd_test'])
        random_parts = scheduler.partition_tests(test_ids, 2, repo, None,
                                                 randomize=True)
        # NOTE(masayukig): We can't test this randomness. So just checking
        # what we should get here.
        self.assertEqual(2, len(random_parts))
        self.assertTrue(isinstance(random_parts, list))
        self.assertTrue(isinstance(random_parts[0], list))
        self.assertTrue(isinstance(random_parts[1], list))
        flatten_random_parts = []
        for i, j in random_parts:
            flatten_random_parts.append(i)
            flatten_random_parts.append(j)
        for i in test_ids:
            self.assertIn(i, flatten_random_parts)

    def test_partition_tests_with_zero_duration(self):

# Path: stestr/repository/memory.py
# class RepositoryFactory(repository.AbstractRepositoryFactory):
# class Repository(repository.AbstractRepository):
# class _Failures(repository.AbstractTestRun):
# class _Inserter(repository.AbstractTestRun):
#     def __init__(self):
#     def initialise(self, url):
#     def open(self, url):
#     def __init__(self):
#     def count(self):
#     def get_failing(self):
#     def get_test_run(self, run_id):
#     def get_run_ids(self):
#     def remove_run_id(self, run_id):
#     def latest_id(self):
#     def _get_inserter(self, partial, run_id=None, metadata=None):
#     def _get_test_times(self, test_ids):
#     def __init__(self, repository):
#     def get_id(self):
#     def get_subunit_stream(self):
#     def get_test(self):
#         def wrap_result(result):
#     def run(self, result):
#     def __init__(self, repository, partial, run_id=None, metadata=None):
#     def startTestRun(self):
#     def _handle_test(self, test_dict):
#     def stopTestRun(self):
#     def status(self, *args, **kwargs):
#     def get_id(self):
#     def get_subunit_stream(self):
#     def get_test(self):
#         def wrap_result(result):
#     def run(self, result):
# 
# Path: stestr/scheduler.py
# def partition_tests(test_ids, concurrency, repository, group_callback,
#                     randomize=False):
#     def noop(_):
#     def consume_queue(groups):
# def local_concurrency():
# def generate_worker_partitions(ids, worker_path, repository=None,
#                                group_callback=None, randomize=False):
# 
# Path: stestr/tests/base.py
# class TestCase(testtools.TestCase):
#     def setUp(self):


# Path: stestr/tests/test_scheduler.py
import datetime
import re
from unittest import mock
from subunit import iso8601
from stestr.repository import memory
from stestr import scheduler
from stestr.tests import base

                              'unknown2', 'unknown3', 'unknown4'])
        partitions = scheduler.partition_tests(test_ids, 2, repo, None)
        self.assertTrue('slow' in partitions[0])
        self.assertFalse('fast1' in partitions[0])
        self.assertFalse('fast2' in partitions[0])
        self.assertFalse('slow' in partitions[1])
        self.assertTrue('fast1' in partitions[1])
        self.assertTrue('fast2' in partitions[1])
        self.assertEqual(3, len(partitions[0]))
        self.assertEqual(4, len(partitions[1]))

    def test_random_partitions(self):
        repo = memory.RepositoryFactory().initialise('memory:')
        test_ids = frozenset(['a_test', 'b_test', 'c_test', 'd_test'])
        random_parts = scheduler.partition_tests(test_ids, 2, repo, None,
                                                 randomize=True)
        # NOTE(masayukig): We can't test this randomness. So just checking
        # what we should get here.
        self.assertEqual(2, len(random_parts))
        self.assertTrue(isinstance(random_parts, list))
        self.assertTrue(isinstance(random_parts[0], list))
        self.assertTrue(isinstance(random_parts[1], list))
        flatten_random_parts = []
        for i, j in random_parts:
            flatten_random_parts.append(i)
            flatten_random_parts.append(j)
        for i in test_ids:
            self.assertIn(i, flatten_random_parts)

    def test_partition_tests_with_zero_duration(self):

        repo = memory.RepositoryFactory().initialise('memory:')