>________________________________ > From: Laura Creighton <l...@openend.se> >To: Michelle Meiduo Wu <wum...@hotmail.com> >Cc: l...@openend.se; "tutor@python.org" <tutor@python.org> >Sent: Thursday, June 11, 2015 11:11 PM >Subject: Re: [Tutor] Python&Pytest > > >In a message of Thu, 11 Jun 2015 09:25:25 -0400, Michelle Meiduo Wu writes: >>Hi there, >>I'm looking for a language to write test scripts for our application. I read >>some document and found Pytest can be used to write simpler code compared >>with using unittest in Python. Does anybody know what's other pros and cons >>of using these two for writing test scripts? >>Thank you,Michelle > >It is very much a 'try it and see what you like' sort of thing. >
Hmm, I think it is possible to give some pros and cons. I have no experience with PyTest. While I usually use unittest (just out of habit), I think nose is much easier and powerful. * Unittest Pros: part of the Standard library powerful, flexible Cons: need to declare a class to define one or more test cases (not so readable) no (easy) test runner * Doctest Pros: part of the Standard library testable documentation Cons: Should be used for (testable) documentation, and nothing else Basic use: easy. More advanced use: hard or impossible No good for Python 2 & 3 code. * Nose Pros: tests are readable; they are simply functions generator tests test runner for just about any other test module cons: not part of the Standard library all tests pass in Python optimized mode (-O or -OO) --> because asserts are used! * Pytest ??? * Dedicated test modules: numpy.testing, PyQt4.QtTest, etc. Use whenever possible? _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor