From the course: Unit Testing and Test Driven Development in Python

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Overview of pytest

Overview of pytest

- [Instructor] In this lecture, I'm going to give you an overview of PyTest. I'll explain exactly what it is and go over its major features. Then I'll show you a quick example. So what is PyTest? PyTest is a Python unit testing framework. It provides the ability to create tests, test modules, test classes, and test fixtures. It uses the built-in Python assert statement which makes implementing unit tests much simpler than other Python unit testing frameworks. It also adds many useful command line arguments to help specify what tests should be run and in what order. So how do you create a unit test in Python with PyTest? In PyTest, individual tests are Python functions with test at the beginning of the function name. The unit tests then execute production code and use the standard Python assert statement to perform verifications on results. Similar tests can be grouped together by including them in the same module or class. Let's look at a quick example. In this example, we'll review…

Contents