We know our unit tests should be relatively independent from other parts of the system. For example, running a test shouldn't generally call a credit card possessing API and talk to a database when your goal is just to test the argument validation. <br/> <br/> And yet, your method does all three of those and more. What do you do? Some languages use elaborate dependency passing frameworks that go under the banner of inversion of control (IoC) and dependency injections (DI). In Python, the most common fix is to temporarily redefine what those two functions do using patching and mocking. <br/> <br/> On this episode, we welcome back Anna-Lena Pokes to talk us through the whole spectrum of test doubles, dummies, mocks, and more.<br/> <br/> <strong>Links from the show</strong><br/> <br/> <div><b>Anna-Lena's personal site</b>: <a href="http://alpopkes.com/" target="_blank" rel="noopener">alpopkes.com</a><br/> <b>100 Days of Code episode</b>: <a href="https://ift.tt/2DqUsKu" target="_blank" rel="noopener">talkpython.fm/186</a><br/> <b>Anna-Lena on Github</b>: <a href="https://ift.tt/2OOP2Mn" target="_blank" rel="noopener">github.com</a><br/> <b>PyCon talk from Lisa Road (2018) - “Demystifying the patch function”</b>: <a href="https://www.youtube.com/watch?v=ww1UsGZV8fQ" target="_blank" rel="noopener">youtube.com</a><br/> <b>PyCon talk from Edwin Jung (2019) - Mocking and Patching Pitfalls</b>: <a href="https://www.youtube.com/watch?v=Ldlz4V-UCFw" target="_blank" rel="noopener">youtube.com</a><br/> <b>Keynote talk “Finding Magic in Python” (about magical universe</b><br/> <b>project)</b>: <a href="https://www.youtube.com/watch?v=Kf92pycivt4" target="_blank" rel="noopener">youtube.com</a><br/> <b>Blog post about mocking in Python</b>: <a href="https://ift.tt/3nNclrF" target="_blank" rel="noopener">alpopkes.com</a><br/> <b>Stackoverflow post on difference between stubs and mocks</b>: <a href="https://ift.tt/2wfCWWh" target="_blank" rel="noopener">stackoverflow.com</a><br/> <b>Freezegun project</b>: <a href="https://ift.tt/TTSkxv" target="_blank" rel="noopener">github.com</a><br/> <b>KI Macht Schule (AI goes to school)</b>: <a href="https://ift.tt/345x5Sn" target="_blank" rel="noopener">ki-macht-schule.de</a><br/> <b>Code Combat</b>: <a href="https://codecombat.com/" target="_blank" rel="noopener">codecombat.com</a><br/> <b>PDB++</b>: <a href="https://ift.tt/31wVMGR" target="_blank" rel="noopener">github.com</a><br/></div><br/> <strong>Sponsors</strong><br/> <br/> <a href='https://ift.tt/3aBjB2k> <a href='https://ift.tt/3jJrRlN> <a href='https://ift.tt/2PVc9qH Python Training</a>
from Planet Python
via read more
Subscribe to:
Post Comments (Atom)
TestDriven.io: Working with Static and Media Files in Django
This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...
-
Podcasts are a great way to immerse yourself in an industry, especially when it comes to data science. The field moves extremely quickly, an...
-
Graph traversal algorithms are used to perform various operations on a graph data structure. In this article, we will use the breadth-first ...
-
In an earlier tutorial we've already covered how to open dialog windows. These are special windows which (by default) grab the focus o...
No comments:
Post a Comment