Try reloading this page, or reviewing your browser settings
Review the main features of the unittest.mock module with a big dive into how to use it effectively and avoid most of the mistakes beginner and intermediate users fall into when using it. The video includes why mocks are needed, how to use them, and how they work; how to patch code to isolate it from internal dependencies; and different kinds of mocks that fit different scenarios.
You will see all this and the common pitfalls with a series of code examples, stepping through the not so well know features of unittest.mock, some of them added only in Python 3.7, that make this library even more powerful.
What You Will Learn
See why testing doubles are needed
Create testing doubles with unittest.mock while using the library
Understand how patches works
Who This Video Is For
People that have used Python and unittest before but aren’t experienced with unittest.mock.
About The Author
Mario Corchero is a software engineer with experience working in large scale systems. Main areas of expertise include SOA, high availability, scalability, API design, Python, C++/Unix, NoSQL and relational databases. He is currently working as senior software engineer at the R&D Python Infrastructure, a team in charge of the infrastructure used across the company to develop, deploy and run all Python code. He is currently based out of London, UK.
About this video
- Mario Corchero
- Online ISBN
- Total duration
- 1 hr 22 min
- Copyright information
- © Mario Corchero 2019
Mario Corchero: Welcome to this course of Unittest.Mock. In this course, we’ll see what are testing doubles and how can we create them by using the mocks . . . the mocks classes within unittest.mock. We’ll have a look into, you know, both of the classes, how can they be used and, uh, especially look into common mistakes and some tips around these. And then after that, we’ll take a dive into patch which is a function within unittest.mock. We’ll see how can it be used to remove internal dependencies and we will go through how it works on the plumbing within it so we can properly understand this function that’s quite often misused and prevent us from making, um, mistakes that we see all over the internet.