Closed MrSampson closed 7 months ago
You’re calling dt.datetime.now()
at import time, which provides a set time to Pydantic. There’s no later function call for time-machine to patch. I think you instead want default_factory=dt.datetime.now
(docs).
Thank you! I didn't even know that existed.
Python Version
3.11.7
pytest Version
7.4.4
Package Version
2.14.1
Description
When using pydantic 2.6.4 Field default values, time machine.travel doesn't seem to have any affect.
After executing the test, the result.time will be the current system time.