When you want to test functions that deal with date, it could be harder than regular tests, especially if you deal with datetime.now, but workarounds exists !

La Volga depuis Nizhny Novgorod

TL;DR

To test processing and functions that use time functions in Python (i.e. datetime.now), you have two strategies: you set or you mock.

The Diff Side

Most of the time you can mock (use a fake object that “mimic the behavior of real objects”) datetime, but sometimes you can not mock because libraries you use in your code check types (ie: dateutil.relativedelta).

For instance if you want to test a function get_beginning_time_window that returns seconds since the…


If you develop in the cloud or on a shared server, you might have experienced the beauty of working with your teamate relying on the same codebase and the same database! Actually, when working on the same cloud environment with other people, it happens that certain resources (files, tables…) are shared between several teammates. This means you can sometimes find yourself blocked because other people are working on the same resource. And it can become frustrating when a file/table you needed is overwritten, moved or deleted…

TL;DR

If you want to do most of your Airflow’s work without relying on a…

Ulysse HUMBERT GONZALEZ

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store