Skip to main content

and
  1. No Access

    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.

    Mario Corchero in Understanding Unittest.Mock (2019)

  2. No Access

    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.

    Mario Corchero in Understanding Unittest.Mock (2019)

  3. No Access

    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.

    Mario Corchero in Understanding Unittest.Mock (2019)

  4. No Access

    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...

    Mario Corchero in Understanding Unittest.Mock (2019)

  5. No Access

    Video Segment

    Validating Calls

    This segment focus on the different tools mock provide to verify how it has been interacted with.

    Mario Corchero in Understanding Unittest.Mock (2019)

  6. No Access

    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...

    Mario Corchero in Understanding Unittest.Mock (2019)

  7. No Access

    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...

    Mario Corchero in Understanding Unittest.Mock (2019)

  8. No Access

    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.

    Mario Corchero in Understanding Unittest.Mock (2019)

  9. No Access

    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.

    Mario Corchero in Understanding Unittest.Mock (2019)

  10. No Access

    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.

    Mario Corchero in Understanding Unittest.Mock (2019)

  11. No Access

    Video Segment

    Patching Objects and Dicts

    This segment explains how can we use patch on dictionaries and existing objects.

    Mario Corchero in Understanding Unittest.Mock (2019)