Joining test coverage from several test directories

Joining test coverage from several test directories This post show a simple way of computing the coverage.py’s test coverage from different tests folders. Introduction I have been using coverage.py since I started working with python, and while it works pretty well, let us say that the interface of the command line tool could be better. I struggled for some minutes trying to filter out other folder I have in my tests folder that were not meant to have their test coverage computed. [Read More]

Joining test coverage in several test directories

Joining test coverage in several test directories This post show a simple way of computing the coverage.py’s test coverage in different tests folders. Introduction I have been using coverage.py since I started working with python, and while it works pretty well, let us say that the interface of the command line tool could be better. I struggled for some minutes trying to filter out other folder I have in my tests folder that were not meant to have their test coverage computed. [Read More]

Patching on setUp in Python's unittest

Patching on setUp in Python’s unittest One of my favorite programming languages is Python, and I think that tests should be a foundational part of software development, so it is not strange that I delve a lot in Python’s unittest. In this post we are going to show how to use unittest.mock.patch not in a decorator (the usual case) but in the setUp method. Why should you care about this? Well, I have not cared about this after more than a decade of working with python (intermittently), because I was just used to the patch decorator. [Read More]

EyesOnly

Secrets are usually involuntary leaked by developers. Sometimes they are sent to external services like or written in a log by accident. Would not be useful to have a tool to limit the access to secrets? Enter EyesOnly. EyesOnly: a package to limit access to secrets Dealing last years with containerazing applications has left me thinking in how we are passing some secrets as environment variables to the container. This is standard practice by the Cloud Native practitioners. [Read More]

Immutability

Introduction In this post I will explain the rationale about working with immutable objects and will present a personal project I’ve been working on the last few days: Gelidum. La nevada by Francisco de Goya Why immutability? Nowadays, most processors have some kind of parallelism or concurrency embedded in themselves. Single-flow-execution software is limited by the lowest speed unit in the system. There are some solutions that try to hide the wait for these slow sub-systems by computing in other execution-flows (threads or processes). [Read More]

Concurrency and third party libraries

Last Friday, one of my mates had a strange error in his code: incoherent an unrepeatable results arise en each execution. His code (Python) was concurrent code and each thread used several libraries (BeautifulSoup41 was one of them) which they were not thread-safe. What does it mean? It means we cannot assure that atomicity is achieved in some operations executed by the threads, effectively sharing some data that must not be shared. [Read More]