arrow
arrow copied to clipboard
FR: Implement context manager to mock time.
I just stumbled upon dmc, a different library for handling dates and times in Python. With this library you are able to mock the current time. It could be like this:
with arrow.mock('2013-05-11T21:23:58.970460+00:00'):
assert arrow.now() == arrow.get('2013-05-11T21:23:58.970460+00:00')
This feature would be very useful for unit testing methods which use arrow.now()
or a related method.
I'd definitely consider this if you or anyone else would like to send me a PR.
Ok, I'll do my best. But it could take a while.
@andrewelkins Is a pull request still desired for this? freezegun's freeze_time method can be an alternative to mock time.