Skip to content Skip to sidebar Skip to footer
Showing posts with the label Mocking

Mock Open() Function Used In A Class Method

I tried to mock the open function used in a method of my class. I found this thread How do I mock a… Read more Mock Open() Function Used In A Class Method

How Can I Mock Sqlite3.cursor

I've been pulling my hair out trying to figure out how to mock the sqlite3.Cursor class specifi… Read more How Can I Mock Sqlite3.cursor

Mocking File Objects Or Iterables In Python

Which way is proper for mocking and testing code that iters object returned by open(), using mock l… Read more Mocking File Objects Or Iterables In Python

How Do I Test That I'm Calling Pickle.dump() Correctly?

I want to test this method: class Data(object): def save(self, filename=''): i… Read more How Do I Test That I'm Calling Pickle.dump() Correctly?

How Do You Pass Exception Arguments To Python Unittest Mock Side Effect?

How do you pass exceptions that require arguments as mock side_effects? I'm trying to test fo… Read more How Do You Pass Exception Arguments To Python Unittest Mock Side Effect?

Running Pytest Tests Against Multiple Backends?

I've built a series of tests (using pytest) for a codebase interacting with the Github API (bot… Read more Running Pytest Tests Against Multiple Backends?