Contribute Media
A thank you to everyone who makes this possible: Read More

Dance with shadows: stubs, patch and mock

Description

EuroPython 2022 - Dance with shadows: stubs, patch and mock - presented by María Andrea Vignau

[Liffey Hall 2 on 2022-07-13]

A comprehensive but simple introduction to the use of fake objects. Explain how to inject this object and use in test using patch and the awesome and powerful mock objects . Last, I present some very interesting specialized libraries for mocking on web development.

Outline

0:00 I present the key factors to use fake objects, and present some dangers.

3:00 Discuss some wanted characteristics in this kind of components.

6:00 Patching: how to do that and some common mistakes. After that I present patch scopes and some disadvantage in the use of this technique.

10:00 Inverse dependency as an possible alternative to patch

13:00 Mocks properties: return value, side effect and specs. Using mocks as spy functions or wrappers. Asserting on callings.

21:00 Using special libraries for mocking. Presenting pyvcr and moto."

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License http://creativecommons.org/licenses/by-nc-sa/4.0/

Improve this page