unittest: Running Legacy Tests with pytest
unittest is the test framework built into the Python standard library. Its purpose is to test Python itself, but it is often used for project testing, too. pytest works as a unittest runner, and can run both pytest and unittest tests in the same session.
Let’s pretend that when the Tasks project started, it used unittest instead of pytest for testing. And perhaps there are a lot of tests already written. Fortunately, you can use pytest to run unittest-based tests. This might be a reasonable option if you are migrating your testing effort from unittest to pytest. You can leave all the old tests as unittest, and write new ones in pytest. You can also gradually migrate older tests as you have time, or ...
Get Python Testing with pytest now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.