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

Social distancing from your system’s dependencies: An API’s Story

Description

How isolating your dependencies can affect your architecture choices and lead to nicer tests

Have you ever imagined life without your tests breaking due to an external dependency having changed? My team chased the dream. We used mocks, stubs, other dependency isolation techniques, and the result was … a lot of ugly tests.

We soon realized our tests required more care and they invoked some difficult questions. Is it possible that the limitations of the testing framework add or give away flaws on your design? Should your architecture be affected by your efforts to test the system? What did we learn in the process?

This presentation will introduce some testing isolation concepts and discuss how the choice of each can affect your architecture design. We will go through the basics of the unittest.mock library and the pytest framework and explore their potential. By diving into scenarios, attendees will learn where these features can be applied more effectively, and more importantly, how an API design can and should be driven by the value of testability, allowing the tests to be structured around clarity, readability and a happy Continuous Integration platform.

The target audience includes beginner Pythonistas, who are looking for ways to structure and test their code cleanly, while intermediate developers will enjoy a fun refreshment on dependency isolation and leave the session with practical examples on how to use it more effectively.

Improve this page