How to detect an undefined method?

Manfred Lotz ml_news at posteo.de
Sun Mar 27 12:48:53 EDT 2022


On 3/27/22 18:36, Skip Montanaro wrote:
>> Let's say I have a Python app and have used an undefined method somewhere.
>> Let
>> us further assume I have not detected it thru my tests.
>>
>> Is there a way to detect it before deploying the app? pylint doesn't
>> notice it.
>>
> 
> This is maybe not exactly what you're looking for, but writing a test to
> exercise that function call (if possible) would be top of my list. Next on
> my list would be to use coverage to get a good idea of what code is not
> tested. Writing more test cases to reduce the number of uncovered lines
> will also make it easier to manually examine the rest of your (untested) code
> to find calls to missing functions or methods.
> 

If the code base is large it might be difficult to have a test case for all
things. But I agree that coverage is surely a good thing to use.


-- 
Manfred



More information about the Python-list mailing list