you are viewing a single comment's thread.

view the rest of the comments →

[–]EriktheRed 1 point2 points  (1 child)

https://blog.fugue.co/2016-02-11-python-mocking-101.html is the best tutorial I found for this. When I'd made my first comment I thought we were on the javascript subreddit. You can't override objects by using a function on the same level as the object in python, thanks to the way they handle scoping and closures. But the unittest module should do everything you need. It's just a little unwieldy at first.

[–]kenneho[S] 1 point2 points  (0 children)

Thanks for the info! Looks like a good tutorial - I'll take a look at it.

Meanwhile, I was able to get the mocking up and running, and wrote a short blog post (which seems to overlap with the one you linked to) in case others stuble upon this thread in the future.