Closed prjemian closed 2 years ago
What features that you want to use are available in pytest and not unittest?
Cleaner test code, easier testing for exceptions, simpler processes to gather stdout & stderr. Also easier to setup a battery of tests that vary the input parameters.
With PyTest, it's my opinion that writing tests is faster than with unittest because of the initial extra work in unittest to setup the test framework in a .py
file. Example with unittest: https://github.com/prjemian/punx/blob/bf3d6f28a37ca735abe21e59e009453d58a49271/tests/finding_test.py#L97-L111
None of this is necessary with pytest. Also, the error reporting is more obvious to me.
Bottom line: With PyTest, I can resolved problems more quickly than with unittest.