DEV Community

Discussion on: Python Peeps: For Unit Testing when do you prefer to use Unittest, Doctest, Pytest ?

Collapse
 
pbouillon profile image
Pierre Bouillon • Edited

I'm fine with unittest.
Putting my tests in different classes allows me to organize a bit more my code by correctly splitting what needs to (package > classes > methods) whether it is about the core or the tests.

I think documentation needs to... Well, document my methods/functions and that tests doesn't belong to it (single responsibility for my docstring?). By writting methods with unittest I can event document them in a more precise way without having 40 lines of text per method :)

And finally, for pytest, I just think unittest allow me more wrapping around the structure of my tests

Just my opinion tho, hope it helps!