0

In my code, I'm using some 3rd party class that has a context manager, e.g. I'm using it with with.

I want to test my method that uses that object, so I wrote a mock object which I want that will be used instead of the 3rd party library class.

How do I patch and mock it so that when __enter__ is called, my object is returned?

ChikChak
  • 874
  • 12
  • 37

0 Answers0