Run python test with constant time using mock

import datetime
import time
import mock
# Ensure constant time.
with mock.patch.object(datetime, 'datetime', mock.Mock(wraps=datetime.datetime)) as patched: = datetime.datetime(2020, 1, 1)
$ python
2020-01-01 00:00:00
2020-01-01 00:00:00
If you liked this posting, please feel free to leave me a comment below.
View this page on GitHub.
Posted .


Leave a Reply