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

Mocking A Socket Connection In Python

I am trying to write unit tests for a class in python. The class opens a tcp socket on init. I am t… Read more Mocking A Socket Connection In Python

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?

Pytest - Patched Method Of A Class Does Not Return The Mock Value

My code is fairly simple but i don't understand what is going on : class MyDb : def some_fun… Read more Pytest - Patched Method Of A Class Does Not Return The Mock Value

How To Mock Session In Python's Request Library?

I have been trying to figure out how exactly to mock the session of Python's request library bu… Read more How To Mock Session In Python's Request Library?

How Should I Verify A Log Message When Testing Python Code Under Nose?

I'm trying to write a simple unit test that will verify that, under a certain condition, a clas… Read more How Should I Verify A Log Message When Testing Python Code Under Nose?

Isinstance And Mocking

class HelloWorld(object): def say_it(self): return 'Hello I am Hello World' de… Read more Isinstance And Mocking