Mocking in Python with unittest.mock - Michael Foord
This episode is a replay of a 2021 interview I did with Michael Foord.We lost Michael in January, and I'd like to revisit this interview as a tribute. Michael Foord was a pivotal figure in the Python community and the creator of the mock library that's now unittest.mock. But he did so much more as well. His contributions continue to resonate within the developer community. This interview is just a small peek at his influence. In this episodeIntroduction to Michael FoordThe Mock Library OriginsMocking and Testing PhilosophyCareer Path and ConsultingUnderstanding MockingThe Power of PatchTesting Strategies and DesignMocking External DependenciesTeaching Testing and Mockingpython.org has put up an "In memoriam" page for Michael Foord, and many people have shared stories and memories.Links:In memoriam: Michael Foord 1974-202530 best practices for software development and testing
-------- Â
47:49
pytest-mock : Mocking in pytest
pytest-mock is currently the #3 pytest plugin. pytest-mock is a wrapper around unittest.mock.In this episode:Why the pytest-mock plugin is awesomeWhat is mocking, patching, and monkey patchingWhat, if any, is the difference between mock, fake, spy, stub. Why we might need these in testingSome history of mock in Python and how mock became unittest.mockFrom unittest.mockpatch.objectpatch.object with autospecusing these as context managerspytest-mock:The mocker fixture Cleanup in teardownUsing mocker.patch, mocker.spy, and mocker.stubWhy it's awesome and why you might want to use it over straight unittest.mockLinks:top pytest plugins listpytest-mock documentationunittest.mockPodcast episode discussing unittest.mock with Michael Foordmonkeypatch
 Learn pytestpytest is the number one test framework for Python.Learn the basics super fast with Hello, pytest!Then later you can become a pytest expert with The Complete pytest CourseBoth courses are at courses.pythontest.com
-------- Â
10:42
pytest-cov : The pytest plugin for measuring coverage
pytest-cov is a pytest plugin that helps produce coverage reports using Coverage.py.In this episode, we'll discuss:what Coverage.py iswhy you should measure code coverage on both your source and test codewhat pytest-cov isextra features pytest-cov gives you over and above coverage.pyand generally why using both is awesomeLinks:coverage.pypytest-covhow to set up context reportsTop pytest PluginsErrata:I mentioned that Coverage has the ability to show context (which line is covered by which test) for the past year or so.However, that feature was released in Oct 2018. coverage 5.0 alpha That's over 6 years. Oops. Sorry Ned.
 Learn pytestpytest is the number one test framework for Python.Learn the basics super fast with Hello, pytest!Then later you can become a pytest expert with The Complete pytest CourseBoth courses are at courses.pythontest.com
-------- Â
12:02
pytest plugins - a full season
This episode kicks off a season of pytest plugins.In this episode:Introduction to pytest pluginsThe pytest.org pytest plugin listFinding pytest related packages on PyPIThe Top pytest plugins list on pythontest.comExploring popular pluginsLearning from plugin examplesLinks:Top pytest plugins listpytest.org plugin listTop PyPI PackagesAnd links to plugins mentioned in the show can be found at pythontest.com/top-pytest-plugins
 Learn pytestpytest is the number one test framework for Python.Learn the basics super fast with Hello, pytest!Then later you can become a pytest expert with The Complete pytest CourseBoth courses are at courses.pythontest.com
-------- Â
11:52
223: Writing Stuff Down is a Super Power
Taking notes well can help to listen better, remember things, show respect, be more accountable, free up mind space to solve problems.This episode discussesthe benefits of writing things downpreparing for a meetingtaking notes in meetingsreviewing notes for action items, todo items, things to follow up on, etc.taking notes to allow for better focuswriting well structured emailswriting blog posts and books
 Learn pytestpytest is the number one test framework for Python.Learn the basics super fast with Hello, pytest!Then later you can become a pytest expert with The Complete pytest CourseBoth courses are at courses.pythontest.com