Brian Weber

Brian is a Site Reliability Engineer at Twitter, where he maintains a robust suite of deployment and monitoring tools. He has also worked at Pinterest and Facebook, where he has worked on deployment, monitoring, and remediation tooling primarily using Python.

Speaker home page

Unit Testing with Mock

Fundamentals, Novice
8/13/2017 | 1:15 PM-2:15 PM | Fisher East


Python's mock library is a handy tool when you need to test your code and only your code. You can use mocks to replace calls to services and libraries that are outside of your code. In this talk, you'll get a breakdown of the features of mocks and several examples of how to implement mocks in your test code.


In this talk you will learn how to use the mock library for writing unit tests. This talk is broken into two basic halves:

  1. Reading the docs: A description of implementations, and some small examples, of how the Mock library is instantiated and used.

  2. Real world implementation: An array of code samples coupled with unit tests to demonstrate various approaches to how to review code and write a unit test.