Doctest: A simple testing framework that allows writing test cases within function docstrings and automatically locates the test cases within the docstrings.
Unittest: A Python built-in library that supports writing class and method-based test cases, separates code and test cases, and the test case names should start with 'test_'.
Pytest: An external Python library that doesn't require writing class-based test cases, provides less verbose and more descriptive outputs, and supports code coverage.
For cases where test cases require specific setup, Unittest provides setUp() and tearDown() functionality, while Pytest provides the @pytest.fixture decorator.