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

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

Olga Matoula

Clean Code System Architecture TDD Test Libraries (pytest/nose/...) Testing

See in schedule

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.

Type: Talk (30 mins); Python level: Beginner; Domain level: Beginner


Olga Matoula

Bloomberg

Olga Matoula joined Bloomberg in 2017 as a full-stack software engineer creating a specialised notepad application for the Bloomberg Professional Terminal. Before that, she was a premier field engineer and a technical solutions professional at Microsoft. From 2014- 2016, she co-founded and ran Code It Like a Girl, an award-winning social enterprise where she taught women and children in Greece how to code. Olga is a Diversity and Inclusion advocate and has participated in panel discussions about inclusivity in tech. Nowadays, she gets involved in tech community events in London and explores a dubious talent in swing dancing.