On Mon, Oct 25, 2010 at 1:49 PM, Aurelien Degremont <[email protected]> wrote: > nap a écrit : >>> . coverage >>> >>> http://nedbatchelder.com/code/coverage/ >>> http://pypi.python.org/pypi/coverage/ >>> >>> When you have unit tests, it is really interesting to use them with >>> Coverage. This is a python tool that will compute >>> the code coverage of those tests and tell you which line of your sources >>> are not tested by them. >>> This is really the unittest best friend. >> Oh we don't use this one, this can be useful to see what we do not >> test from now. Thanks! :) > > Do not hesitate to ask question if you have any difficulties with it. Thanks :)
I'll include it in our standard test*sh scripts :) > >>> . pylint >>> >>> Pylint si code checker developed by french team Logilab. It is checking a >>> lot (a lot!) of things on your Python code. It >>> can detect bugs without running the code. It checks the PEP8 conformity >>> which is important IMHO for any Python >>> collaboration. And a lot more. It is highly configurable, and I strongly >>> advise any python developer to try to run it on >>> its code. >> I passed some pylint passes some months ago, and with a good >> configuration it even solve bugs! (it make me saw some = instead of == >> bugs before we use TDD...). But with a standard conf, it warn about >> properties used but not created in the __init__ but it's normal with >> the properties dict. > > You can disable some checks if you really think it is a false positive in > your case. > But I advise do not do so in most of cases. > By example, this checks had help me to detect some typos like: > > def MyClass(object): > def __init__(self): > self._mydata = 1 > def inc(self): > self._myata += 1 > > This is correct and will not raise syntax error, but in this case, pylint > will tell you that _myata is not declared in > __init__, so you can detect your mistake. That's why one must be carefull > when disabling some warnings :) Yes, but it will warn us about all properties in fact, taht why it will be hard to see real errors in it. > >> It also warn about 80+ lines (lot for again the >> properties dict... :p ). But we'll pass a big pylint in the code >> before the next release, thanks to remember this tool :) > > I also notice that you can transform some of your comment into proper method > doc. I do not really like docstrings. In fact, it's the separation between the function prototype and the real code that annoy me. I like to see the comments before the function, so I can see in the prototype and code in quite the same lines. But maybe I didn't look enough to others Python code for this. I'll try and see if it's so annoying that it was for me :) > > I agree that sometimes it is not easy to solve all warnings raised by pylint, > but it is a minimum to be rated 9 :) > >>> Hoping this can help Shinken. >> Oh yes, the coverage will help us to spot what is not fully tested (I >> think the pyro part because it's not easy with unit tests... :( ). > > I agree that functionnal tests are difficult with unittest. But I think your > test can setup several shinken components > that talks through loopback interface? Pyro should be happy with this? Oh yes, it's not a problem for him. It just need some more code to put random ports and catch some things like it, but such part of code need to be fully tested :) Jean > > > > Aurelien > > > ------------------------------------------------------------------------------ > Nokia and AT&T present the 2010 Calling All Innovators-North America contest > Create new apps & games for the Nokia N8 for consumers in U.S. and Canada > $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store > http://p.sf.net/sfu/nokia-dev2dev > _______________________________________________ > Shinken-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/shinken-devel > ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ Shinken-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/shinken-devel
