I have created a python test where I am mocking a logging function. I then test to make sure that the number of loccking_mock.mock_calls is what I expected.
I'm using pycharm. When I run the code, the test passes, but when I debug it (with a breakpoint in the line with my assert statement), it doesn't pass, and logging_mock.mock_calls contains a lot of unexpected call.__str__() calls. The number of call.__str__() calls listed varies each time.
In the process of debugging, I commented out all of the functionality in my main method but I am still getting this problem. Here is the code that still gives me this problem:
@mock.patch('app.helpers.logging')
def test_main(self, logging_mock):
"""
Test the main method
"""
main()
self.assertEqual(0, len(logging_mock.mock_calls))
And here's my empty main:
def main():
pass
Why is there a varying number of call.__str__() calls when I run this in my debugger?