For each chapter in Finding Ghosts in Your Data, I’ll include a few resources that I found interesting. This isn’t a bibliography, strictly speaking, as I might not use all of these in the course of writing, but they were at least worth noting.
Is This Thing On?
The theme for chapter 5 is testing, so almost all of the links are related to that. Specifically, I broke this down into unit testing and integration testing.
For unit testing, there are a few really good frameworks, such as pytest, pytesting, and unittest. I landed on pytest and appreciate the API reference and examples they provide. When it comes to writing test cases, I enjoyed Goran Aviani’s introduction to unit testing in Python.
As far as integration testing goes, there are integration test suites like integrate, though my primary point for interaction is via FastAPI, and so I decided to use Postman, as I have a pretty good amount of experience with it. Writing tests on Postman is pretty easy, though automating via newman is not trivial.
Something I thought about doing but haven’t done yet is to integrate in GitHub Actions to automate test-running. Kevin Fawcett has a really good post on the topic, as does Rupert Thomas.
Writing Testable Code
The last set of links for this chapter relate to writing high-quality, testable code in Python. Noah Gift has a good article on the topic, giving some ideas about how we might try to understand and measure code complexity.
What I was really looking for when I went down this road was Sebastian Buczynski’s Clean Architecture in Python work. Sebastian has a big article, a follow-up article, and a book on the topic. Think of this as the object-oriented approach in Python, heavy in dependency injection and mockable object modeling.
I actually take a different tack than Sebastian in writing the code for the book, but I do give an explicit call-out to the concept of Clean Architecture and Sebastian’s book. In a post in the not-too-distant future, I’ll include an excerpt talking about my style of writing testable code.
3 thoughts on “Interesting Resources for Chapter 5”
Thanks for mentioning my work!
I saw in the other post you elaborated on the approach you prefer which focuses on pure functions. I was wondering if you are familiar with Gary Bernhardt’s talk “Boundaries”? He also leverages functional approach but also shows how to deal with side-effect heavy stuff
Thank you for the info on that talk. I don’t think I’ve seen it yet so I’m going to check it out.