How to fake properly (glt19)


Manage episode 232220335 series 1330870
By Discovered by Player FM and our community — copyright is owned by the publisher, not Player FM, and audio streamed directly from their servers.
Aiming at complete code coverage by unit tests tends to be cumbersome, especially for cases where external API calls a part of the code base. Python attempts to address this issue with its unittest.mock library, appearing to be a powerful companion in replacing parts of the system under test. First and foremost, there will be a thorough discussion of the relevant use cases implemented in Python’s unittest.mock library. To move on, I will outline how this mocking functionality can be embedded in a pytest based test suite, amongst discussing the feasibility of replacing parts of the system under test. Eventually, I will discuss examples of production code unit tests that make use of the mock object library, thereby contributing to a solid understanding of the matter. about this event:

5346 episodes available. A new episode about every 5 hours averaging 49 mins duration .