The Yelp code base has been in development for more than six years. One of Python's best features is its "batteries included" mentality, which allows us to use a variety of wonderful libraries, including the built-in unittest module. On the other hand, our testing requirements rise in tandem with the growth and complexity of our codebase.
Nose and unittest are two open-source libraries that have been developed to help supplement Python testing.
Testify is a Python module that replaces the unittest module and nose. It is modeled after unittest, and it fully supports existing unittest classes.
Testify is based on unittest but with more capabilities and support for unittest classes. It contains more pythonic naming standards, a more visually appealing test runner output, and a decorator-based approach to fixture methods, among other things.
Testify includes functionalities that go beyond unittest:
- Teardown fixture methods and Class-level setup are run only once for an entire class of test methods.
- A decorator-based approach to fixture methods allows for features like lazy attribute evaluation and test context managers.
- Test discovery has been improved. Testify can search across packages for test cases (similar to nose).
- Support for finding and running test suites organized by modules, classes, or test methods.
- The output of the test runner is attractive (color).
- Extensible plugin system for providing new reporting functions.
- Turtle (for mocking), code coverage integration, profiling, and various everyday assertion helpers for faster debugging are among the other helpful testing facilities included.
- More naming standards in Python.
Now, we will look at the installation of Testify.