Hacker News new | ask | show | jobs
by bb88 1593 days ago
Replace the original function with a wrapper that calls the function then does the side effect.

This could effectively be something like a decorator.

As far as mocking time objects, look into pytest.freezegun. You should be able to control the date and time as you move forward.

I was able to mock out the datetime.now() at some point in the past. It wasn't with freezegun...