fix: set uuid._last_timestamp_v7 to reset uuid7 state#597
fix: set uuid._last_timestamp_v7 to reset uuid7 state#597decardev wants to merge 4 commits intoadamchainz:mainfrom
uuid._last_timestamp_v7 to reset uuid7 state#597Conversation
pauloxnet
left a comment
There was a problem hiding this comment.
Added a small code suggestion
| if not hasattr(uuid, "uuid7"): | ||
| pytest.skip("uuid.uuid7 is not available") |
There was a problem hiding this comment.
Only to make mypy happy. What is prefered here?
@pytest.mark.skipif(...) or internal check?
|
I had to move the logic to the Traveller to resolve nesting or fixture usage. |
|
You didn't provide a bug report. Please say what happens currently. An exception, faulty uuid generation, ...??? I'm not super in favour of adding a special patch in here for uuid7, since it's somewhat niche, and we could surely add similar patches for dozens of third-party libraries with a similar pattern of storing a timestamp. I'm leaning more towards making this a user responsibliity, but maybe something time-machine can assist with by providing something like a signals system for each time the time changes. On that note, patching |
Thank you for the feedback, #601.
|
I came across this issue when using both
freeegunandtime_machine.3.14::uuid7keeps track of_last_timestamp_v7to derive next value. To move forward and back in time this value must be re-set to None.