|
|
|
|
|
by drchickensalad
1593 days ago
|
|
How do you add a side effect and still call the original in pytest? This is easy in rspec but everywhere I google people say there's no good way. For example, you're calling code which internally does Too().bar() and you want to advance your time mock after it's called. |
|
You’d probably use something like `wraps` or `side_effect` in `unittest.mock` to delegate to the original with some extra behaviours.
And / or use freezegun’s tick features, when you’re specifically dealing with time.