Home
Categories
EXPLORE
True Crime
Comedy
Society & Culture
Business
Sports
Technology
Health & Fitness
About Us
Contact Us
Copyright
© 2024 PodJoint
Podjoint Logo
US
00:00 / 00:00
Sign in

or

Don't have an account?
Sign up
Forgot password
https://is1-ssl.mzstatic.com/image/thumb/Podcasts211/v4/bc/83/56/bc835690-12d4-9398-f8f8-234889fc4702/mza_11760862679876056298.jpg/600x600bb.jpg
Test & Code
Brian Okken
237 episodes
2 months ago
The Python Test Podcast hosted by Brian Okken
Show more...
Technology
Education,
How To
RSS
All content for Test & Code is the property of Brian Okken and is served directly from their servers with no modification, redirects, or rehosting. The podcast is not affiliated with or endorsed by Podjoint in any way.
The Python Test Podcast hosted by Brian Okken
Show more...
Technology
Education,
How To
https://is1-ssl.mzstatic.com/image/thumb/Podcasts211/v4/bc/83/56/bc835690-12d4-9398-f8f8-234889fc4702/mza_11760862679876056298.jpg/600x600bb.jpg
226: pytest-mock : Mocking in pytest
Test & Code
11 minutes
9 months ago
226: 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 awesome
  • What is mocking, patching, and monkey patching
  • What, if any, is the difference between mock, fake, spy, stub. 
  • Why we might need these in testing
  • Some history of mock in Python and how mock became unittest.mock
  • From unittest.mock
    • patch.object
    • patch.object with autospec
    • using these as context managers
  • pytest-mock:
    • The mocker fixture 
    • Cleanup in teardown
    • Using mocker.patch, mocker.spy, and mocker.stub
    • Why it's awesome and why you might want to use it over straight unittest.mock

Links:

  • top pytest plugins list
  • pytest-mock documentation
  • unittest.mock
  • Podcast episode discussing unittest.mock with Michael Foord
  • monkeypatch

Help support the show AND learn pytest: 

  • The Complete pytest course is now a bundle, with each part available separately.
    • pytest Primary Power teaches the super powers of pytest that you need to learn to use pytest effectively.
    • Using pytest with Projects has lots of "when you need it" sections like debugging failed tests, mocking, testing strategy, and CI
    • Then pytest Booster Rockets can help with advanced parametrization and building plugins.
  • Whether you need to get started with pytest today, or want to power up your pytest skills, PythonTest has a course for you.

★ Support this podcast on Patreon ★
Test & Code
The Python Test Podcast hosted by Brian Okken