3 ms·
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 a
by bb88 5y 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...