0

I am trying to write an integration test for my python app and having trouble coming up with a good way to mock the logger. Under my tests, I have the following

assert os.system(f"cd {TEST_PATH}; python ../../happy.py apply") == 256

This is working fine but I want to mock a method inside happy.py which is responsible to create a logger so that my tests do not log. How do I do that?

I appreciate any inputs.

oyeesh
  • 551
  • 9
  • 21

1 Answers1

0

I was able to solve this issue by changing my main() method to receive the arguments and then using pytest's mocker.patch to mock the logger.

oyeesh
  • 551
  • 9
  • 21