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

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 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?

Using Python's Mock Patch.object To Change The Return Value Of A Method Called Within Another Method

Is it possible to mock a return value of a function called within another function I am trying to t… Read more Using Python's Mock Patch.object To Change The Return Value Of A Method Called Within Another Method

Does Someone Have An Example Of Unit-testing A Soap Api With Python Zeep And Mock?

I'm building a Python app that accesses a 3rd party SOAP API with Python-zeep. I want to implem… Read more Does Someone Have An Example Of Unit-testing A Soap Api With Python Zeep And Mock?

Mocked Unit Test Raises A "stop Called On Unstarted Patcher" Error

When running the test bellow, I got a stop called on unstarted patcher. def test_get_subvention_int… Read more Mocked Unit Test Raises A "stop Called On Unstarted Patcher" Error

Mock Builtin 'open" Function When Used In Contextlib

I know this question has been asked before, but I have a particular problem, meaning I want the moc… Read more Mock Builtin 'open" Function When Used In Contextlib

Mock.patch And Multiprocessing

I'm struggling to use mock.patch in a multiprocessing environment while without multiprocessing… Read more Mock.patch And Multiprocessing