Skip to content

sort by tests by some_hash_fn(f"{item.id!r}{randomly_seed}") rather than shuffle #210

@graingert

Description

@graingert

shuffle with the same seed isn't stable for item subsets and supersets:

import random


def shuffle(seed, v):
    v = list(v)
    random.Random(x=seed).shuffle(v)
    return v


assert (
    shuffle(1, "abcd") == ["d", "a", "c", "b"]
    and shuffle(1, "abc") == ["b", "c", "a"]
)

eg if you remove tests due to "--lf" or "--sw", or add/remove tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions