Fun times with unittest.mock
In foo.py: In test_foo.py (running under pytest, with pytest-mock): It took me a tick to realize that the function definition was being evaluated at import time, including the values for the kwargs. Even though the body, of course, wasn’t being evaluated. I solved it with this change to foo.py: This is related to the thing …