Unit testing—which involves testing small, isolatable pieces of code—can help you catch and fix bugs before they crop up in your final product. And by adopting test-driven development (TDD) and writing unit tests before production code, you can take even greater responsibility for your project's quality. Curious about how to best approach unit testing in your own Python projects? This course shows you how. Join instructor Jasmine Omeke as she goes over TDD techniques for Python projects using the pytest testing framework and a Docker container.
Jasmine begins by providing a basic overview of both TDD and pytest as she shows how to write a basic test. She then delves into how to use pytest features to automatically run unit tests, as well as how to best organize your pytest projects. Then, see how to hop into an existing project and use pytest tests to figure out the core behavior of the source code, determine which source code functions still need to be tested, and add in more tests.
- As a developer, you're constantly prioritizing what you should focus on and figuring out how today's work fits into those long-term goals. When building and testing Python projects from scratch, you may lose sight of this goal as you try to implement too many features at once. When maintaining a Legacy project, you may feel overwhelmed as you find it has too few or no tests. Believe it or not, test-driven development may be just what you need to organize the path ahead of you. We'll explore that in this course in concert with pytest, a testing framework. I'm Jasmine Omeke, and I'm a software developer working on a big data and analytics platform. I've also contributed to open source projects such as gRPC, Apache Airflow, and pytest. I have learned a lot about prioritization, and I want to talk about that through the lens of pytest. We will focus on pytest and its capabilities. Paired with test-driven development, pytest will help you become more productive as you pragmatically write modular tests. To help you continue practicing your newfound pytest knowledge, I will recommend potential sample projects as we make our way through the course. I'm excited to have you join me, and please let me know what feedback you have.