PyCon Israel 2023

🇮🇱 Taming Nondeterminism with Dependency Injection
2023-07-04, 10:30–10:50, Hall 3 (2nd Floor)

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!


Session language – Hebrew Target audience – Developers Other (target audience) – This talk is intended for all Python developers.