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 fails once in a while for no apparent reason, it's possible your code is relying on something that 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 randomness, IO, environment variables, databases and many more. One way to control nondeterminism in tests, is using dependency injection.

Dependency injection is a pattern that provides a good way to control nondeterminism in code, and makes it easier to write tests.

In this talk I'll demonstrate how nondeterminism can pose incredible challenges even in simple functions, and how to implement dependency injection to address these problems!

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