Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write modern Python tests?

Tags:

python

testing

What is the latest way to write Python tests? What modules/frameworks to use?

And another question: are doctest tests still of any value? Or should all the tests be written in a more modern testing framework?

Thanks, Boda Cydo.

like image 815
bodacydo Avatar asked Feb 28 '10 20:02

bodacydo


1 Answers

The usual way is to use the builtin unittest module for creating unit tests and bundling them together to test suites which can be run independently. unittest is very similar to (and inspired by) jUnit and thus very easy to use.

If you're interested in the very latest changes, take a look at the new PyCon talk by Michael Foord:

PyCon 2010: New and Improved: Coming changes to unittest

like image 102
AndiDog Avatar answered Sep 23 '22 06:09

AndiDog