예제 #1
0
 ]),
 # Case 2, alphanumerical
 (ordering.AlphanumericSorter(), [
     ('Multitest', [
         ('Alpha', ['test_aaa', 'test_bbb', 'test_ccc']),
         ('Beta', ['test_aaa', 'test_ccc', 'test_xxx']),
     ]),
 ]),
 # Case 3, shuffle all
 (ordering.ShuffleSorter(seed=7), [
     ('Multitest',
      py_version_data(
          py2=[
              ('Alpha', ['test_bbb', 'test_aaa', 'test_ccc']),
              ('Beta', ['test_xxx', 'test_aaa', 'test_ccc']),
          ],
          py3=[
              ('Beta', ['test_aaa', 'test_ccc', 'test_xxx']),
              ('Alpha', ['test_aaa', 'test_ccc', 'test_bbb']),
          ],
      ))
 ]),
 # # Case 4, shuffle suites
 (ordering.ShuffleSorter(seed=7, shuffle_type='suites'), [
     ('Multitest',
      py_version_data(
          py2=[('Alpha', ['test_ccc', 'test_bbb', 'test_aaa']),
               ('Beta', ['test_ccc', 'test_xxx', 'test_aaa'])],
          py3=[('Beta', ['test_ccc', 'test_xxx', 'test_aaa']),
               ('Alpha', ['test_ccc', 'test_bbb', 'test_aaa'])]))
 ]),
 # # Case 5, shuffle testcases
예제 #2
0
    "value",
    (
        "foo",
        1,
        object(),
        [1, 2],
        ("all", "testcases"),
        ("testcases", "something-else"),
    ),
)
def test_shuffle_type_enum_validate_failure(value):
    with pytest.raises(ValueError):
        ordering.SortType.validate(value)


expected_shuffled = py_version_data(py2=[1, 2, 5, 3, 4], py3=[1, 2, 4, 3, 5])


class TestShuffleSorter(object):
    def test_shuffle(self):
        arr = [1, 2, 3, 4, 5, 6, 7, 8]
        shuffled = list(arr)

        sorter = ordering.ShuffleSorter(seed=5)
        sorter.randomizer.shuffle(shuffled)

        assert shuffled != arr
        assert sorter.sorted_instances(arr) == shuffled
        assert sorter.sorted_testsuites(arr) == shuffled
        assert sorter.sorted_testcases(arr) == shuffled
예제 #3
0
         [
             ("Alpha", ["test_aaa", "test_bbb", "test_ccc"]),
             ("Beta", ["test_aaa", "test_ccc", "test_xxx"]),
         ],
     )],
 ),
 # Case 3, shuffle all
 (
     ordering.ShuffleSorter(seed=7),
     [(
         "Multitest",
         py_version_data(
             py2=[
                 ("Alpha", ["test_bbb", "test_aaa", "test_ccc"]),
                 ("Beta", ["test_xxx", "test_aaa", "test_ccc"]),
             ],
             py3=[
                 ("Beta", ["test_aaa", "test_ccc", "test_xxx"]),
                 ("Alpha", ["test_aaa", "test_ccc", "test_bbb"]),
             ],
         ),
     )],
 ),
 # # Case 4, shuffle suites
 (
     ordering.ShuffleSorter(seed=7, shuffle_type="suites"),
     [(
         "Multitest",
         py_version_data(
             py2=[
                 ("Alpha", ["test_ccc", "test_bbb", "test_aaa"]),
                 ("Beta", ["test_ccc", "test_xxx", "test_aaa"]),