Stop Using datetime.now! | Haki Benita

If you ever had a test that one day just started to fail, unprovoked, or a test that fails once every blue moon for no apparent reason, it’s possible your code is relying on something that is not deterministic. In this article I describe a practical approach to dependency injection in Python that when used correctly, can eliminate nondeterminism and make your code easier to maintain and to test.