![Loading...](https://link.springer.com/static/c4a417b97a76cc2980e3c25e2271af3129e08bbe/images/pdf-preview/spacer.gif)
-
Video Segment
Testing Doubles
This segment introduces the base of the code that we want to tests and creates a test to verify it. As the test has a dependency, we create manually a testing double to isolate it.
-
Video Segment
Creating Spies
This segment focus on the usage of the wraps keyword, a not well known feature of mocks that allow inspecting interactions with real objects.
-
Video Segment
Other Ways to Patch
How to patch existing objects, the open function, dynamic values, using it as a decorator (and its pitfalls) etc.
-
Video Segment
Using unittest.mock
We recreate the same testing double that we created manually with the library, we show how easier it is to do it and how few code it is needed now. We see another example where we also need to specify magic me...
-
Video Segment
Validating Calls
This segment focus on the different tools mock provide to verify how it has been interacted with.
-
Video Segment
Restricted
This segment shows one of the most common mistakes when using mocks, the lack of control on the child mock feature. By using spec and seal, a new feature in Python3.7 we ensure our mocks work as we expect them...
-
Video Segment
Understanding How Patch Works
Explanation of how patch works and how to do it properly. By understanding the internals of how it is implemented users discover “the magic” behind it, which helps avoiding many of the mistakes you see in inte...
-
Video Segment
Mocks in pytest
Examples of how to combine mocks in pytest and common pitfalls when patching and using fixtures in the same test scenario.
-
Video Segment
Creating Complex Mocks
This segment describes how the automatic creation of child mocks on attribute access work and why it is useful, especially for tests where we want a dummy.
-
Video Segment
Mocking Internal Dependencies
An overview of how our Python code can have internal dependencies that make it hard to test and how we can use the patch function to replace them.
-
Video Segment
Patching Objects and Dicts
This segment explains how can we use patch on dictionaries and existing objects.