Skip to content

Reseed errors out with numpy legacy seeding #689

Description

@jerry-reevo

Python Version

3.13

pytest Version

8.4.2

Package Version

4.0.0

Description

When paired with numpy v2.3.2 using macOS arm64, I get the following error when --randomly-seed is not provided:

    def pytest_runtest_teardown(item: Item) -> None:
        if item.config.getoption("randomly_reset_seed"):
>           _reseed(item.config, _crc32(item.nodeid) + 1)

.venv/lib/python3.13/site-packages/pytest_randomly/__init__.py:212: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.venv/lib/python3.13/site-packages/pytest_randomly/__init__.py:180: in _reseed
    reseed(seed)
.venv/lib/python3.13/site-packages/thinc/util.py:96: in fix_random_seed
    numpy.random.seed(seed)
numpy/random/mtrand.pyx:4828: in numpy.random.mtrand.seed
    ???
numpy/random/mtrand.pyx:254: in numpy.random.mtrand.RandomState.seed
    ???
numpy/random/_mt19937.pyx:168: in numpy.random._mt19937.MT19937._legacy_seeding
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   ValueError: Seed must be between 0 and 2**32 - 1

numpy/random/_mt19937.pyx:182: ValueError

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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