Taming Nondeterminism with Dependency Injection
Language: Hebrew
The presentation was given on 2023.07.04 at PyCon Israel 2023 - Conference.
If you ever had a test that started to fail unprovoked or once in a while for no apparent reason, it's possible your code is relying on something that is non-deterministic. In this talk, I propose a simple way to address these challenges in Python!
There are many sources of nondeterminism in code such as randomness, IO, environment variables, databases and many more. Dependency injection is a pattern that provides a way to control nondeterminism in code and make tests easier to write.
In this talk I'll demonstrate how nondeterminism can pose challenges even in simple functions, and how to use dependency injection to address these problems!