Skip to content

test_same_millisecond_overflow is non-deterministic #55

@hugobuddel

Description

@hugobuddel

Occasionally, test_same_millisecond_overflow fails, about 1 in 20 times or so:

bash-5.2$ python -m pytest
======================== test session starts =========================
platform linux -- Python 3.12.12, pytest-9.0.2, pluggy-1.6.0
rootdir: /[...]/python-ulid
configfile: pyproject.toml
collected 69 items                                                   

tests/test_base32.py .............                             [ 18%]
tests/test_cli.py ..............                               [ 39%]
tests/test_ulid.py ..........................................  [100%]

========================= 69 passed in 1.05s =========================
bash-5.2$ python -m pytest
======================== test session starts =========================
platform linux -- Python 3.12.12, pytest-9.0.2, pluggy-1.6.0
rootdir: /[...]/python-ulid
configfile: pyproject.toml
collected 69 items                                                   

tests/test_base32.py .............                             [ 18%]
tests/test_cli.py ..............                               [ 39%]
tests/test_ulid.py ......F...................................  [100%]

============================== FAILURES ==============================
___________________ test_same_millisecond_overflow ___________________

    @freeze_time()
    def test_same_millisecond_overflow() -> None:
        ULID.provider.prev_randomness = constants.MAX_RANDOMNESS
>       with pytest.raises(ValueError, match="Randomness within same millisecond exhausted"):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       Failed: DID NOT RAISE <class 'ValueError'>

tests/test_ulid.py:73: Failed
====================== short test summary info =======================
FAILED tests/test_ulid.py::test_same_millisecond_overflow - Failed: DID NOT RAISE <class 'ValueError'>
==================== 1 failed, 68 passed in 1.22s ====================
bash-5.2$ 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions