Open pylint-bot opened 9 years ago
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):
I don't think there's anyway for pylint to figure out what mock is doing behind the scene in a sane way. These kind of libraries which overuses dynamic features of the language aren't well suited for a static analysis understanding.
But this might be solvable with an astroid brain plugin.
Original comment by Oliver Jeeves (BitBucket: ojeeves):
This problem only occurs when you're mocking a module. Pylint correctly finds the type of the mock if you're mocking a function, class or method.
Originally reported by: Anonymous
Give these two files:
sut.py:
and test.py:
The code works fine:
But pylint incorrectly determines that self.os_mock is of type dict:
The test_mock_is_mock test above shows that this is explicitly not the case.
This is using python 2.7.6